From 3214da5749135c282f4eea2f2423a92dd08d4b94 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Sat, 30 Apr 2022 15:26:22 +0000
Subject: [PATCH] dev_jmb39x_raid.cpp: Enhance LBA range from 33-62 to 1-255
 (#1594). smartctl.8.in: Update related documentation.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5366 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/ChangeLog           |  5 +++++
 smartmontools/dev_jmb39x_raid.cpp |  6 +++---
 smartmontools/smartctl.8.in       | 12 +++++++++---
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index f08b5c7b4..481f6d4ca 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -1,5 +1,10 @@
 $Id$
 
+2022-04-30  Christian Franke  <franke@computer.org>
+
+	dev_jmb39x_raid.cpp: Enhance LBA range from 33-62 to 1-255 (#1594).
+	smartctl.8.in: Update related documentation.
+
 2022-04-27  Gabriele Pohl  <contact@dipohl.de>
 
 	drivedb.h:
diff --git a/smartmontools/dev_jmb39x_raid.cpp b/smartmontools/dev_jmb39x_raid.cpp
index dd768ecaa..6e71a177f 100644
--- a/smartmontools/dev_jmb39x_raid.cpp
+++ b/smartmontools/dev_jmb39x_raid.cpp
@@ -3,7 +3,7 @@
  *
  * Home page of code is: https://www.smartmontools.org
  *
- * Copyright (C) 2019-21 Christian Franke
+ * Copyright (C) 2019-22 Christian Franke
  *
  * Based on JMraidcon (same license):
  *   Copyright (C) 2010 Werner Johansson
@@ -729,8 +729,8 @@ ata_device * smart_interface::get_jmb39x_device(const char * type, smart_device
     force = true;
     n1 += n2;
   }
-  if (!(n1 == len && port <= 4 && 33 <= lba && lba <= 62)) {
-    set_err(EINVAL, "Option -d %s,N[,sLBA][,force] must have 0 <= N <= 4 [, 33 <= LBA <= 62]", prefix);
+  if (!(n1 == len && port <= 4 && 1 <= lba && lba <= 255)) {
+    set_err(EINVAL, "Option -d %s,N[,sLBA][,force] must have 0 <= N <= 4 [, 1 <= LBA <= 255]", prefix);
     return 0;
   }
 
diff --git a/smartmontools/smartctl.8.in b/smartmontools/smartctl.8.in
index 9352f3161..436aea754 100644
--- a/smartmontools/smartctl.8.in
+++ b/smartmontools/smartctl.8.in
@@ -729,11 +729,17 @@ some QNAP NAS devices.
 The integer N is the port number from 0 to 4.
 .br
 \fBWARNING: The ATA pass-through commands are issued via READ/WRITE commands
-to LBA 33 of the RAID volume.
+to a LBA of the RAID volume.
 Using this option with other devices may overwrite this sector.\fP
 .br
-The LBA could be selected in the range 33 (last sector of a GPT) to 62 (last
-sector of traditional boot area).
+The default LBA is 33.
+The LBA could be selected in the range from 1 to 255 inclusive.
+.br
+If a GPT partition table is used, LBA 33 contains the last 4 (of 128)
+entries of the partition table.
+These entries are zero filled in most cases.
+If a MBR partition table is used, LBA 33 may be zero filled or may contain
+code from a boot loader.
 .br
 By default, access to the device is refused if the selected sector is not
 zero filled.
-- 
GitLab