Skip to contentSkip to conversation

BLKGETSIZE64 broken in 2.4.18-pre1, 2.5.2-pre7

PATCH New Eric Sandeen 1 participant 1 message Jan 4, 2002 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BLKGETSIZE64 broken in 2.4.18-pre1, 2.5.2-pre7

BLKGETSIZE64 is supposed to return device size in bytes:

#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* return device size in bytes (u64 *arg) */

but in drivers/block/blkpg.c, it's just returning device size/512 as a u64 number.

This patch should apply to both kernels.

drivers/block/blkpg.c renamed from drivers/block/blkpg.c.orig +1 -1
@@ -247,7 +247,7 @@
 			if (cmd == BLKGETSIZE)
 				return put_user((unsigned long)ullval, (unsigned long *)arg);
 			else
-				return put_user(ullval, (u64 *)arg);
+				return put_user(ullval << 9, (u64 *)arg);
 #if 0
 		case BLKRRPART: /* Re-read partition tables */
 			if (!capable(CAP_SYS_ADMIN)) 
Signature · 2 lines
Eric Sandeen      XFS for Linux     http://oss.sgi.com/projects/xfs
[email protected]   SGI, Inc.