Patchwork hdparm: Fix error in sector offset reporting

login
register
mail settings
Submitter Martin K. Petersen
Date Jan. 23, 2010, 7:18 p.m.
Message ID <yq1fx5wwryk.fsf@sermon.lab.mkp.net>
Download mbox | patch
Permalink /patch/43583/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Martin K. Petersen - Jan. 23, 2010, 7:18 p.m.
The sector offset reporting is off by a factor of two...

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Lord - Jan. 24, 2010, 6:16 a.m.
Martin K. Petersen wrote:
> The sector offset reporting is off by a factor of two...
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> 
> diff -urN -X /home/mkp/bin/dontdiff hdparm-9.27.orig/identify.c hdparm-9.27/identify.c
> --- hdparm-9.27.orig/identify.c	2009-08-20 10:31:01.000000000 -0400
> +++ hdparm-9.27/identify.c	2010-01-23 14:07:43.000000000 -0500
> @@ -938,7 +938,7 @@
>  			printf("\t%-31s %11u bytes\n","Physical Sector size:", sector_bytes * pfactor);
>  			if ((val[209] & 0xc000) == 0x4000) {
>  				unsigned int offset = val[209] & 0x1fff;
> -				printf("\t%-31s %11u bytes\n", "Logical Sector-0 offset:", offset * lsize);
> +				printf("\t%-31s %11u bytes\n", "Logical Sector-0 offset:", offset * sector_bytes);
..

Thanks, applied.   I *like* easy fixes like that!

-ml
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urN -X /home/mkp/bin/dontdiff hdparm-9.27.orig/identify.c hdparm-9.27/identify.c
--- hdparm-9.27.orig/identify.c	2009-08-20 10:31:01.000000000 -0400
+++ hdparm-9.27/identify.c	2010-01-23 14:07:43.000000000 -0500
@@ -938,7 +938,7 @@ 
 			printf("\t%-31s %11u bytes\n","Physical Sector size:", sector_bytes * pfactor);
 			if ((val[209] & 0xc000) == 0x4000) {
 				unsigned int offset = val[209] & 0x1fff;
-				printf("\t%-31s %11u bytes\n", "Logical Sector-0 offset:", offset * lsize);
+				printf("\t%-31s %11u bytes\n", "Logical Sector-0 offset:", offset * sector_bytes);
 			}
 		}
 		if (!bbbig) bbbig = (__u64)(ll>mm ? ll : mm); /* # 512 byte blocks */