Skip to contentSkip to conversation

ide: ide-cd.c blocklen is a big-endian value

PATCH In review Harvey Harrison 3 participants 4 messages Jul 23, 2008 – Jul 24, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ide: ide-cd.c blocklen is a big-endian value

Noticed by sparse between next-20080722 and next-20080723

---
 drivers/ide/ide-cd.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/ide/ide-cd.c +5 -5
index 3a6fef5..a384500 100644
@@ -1318,17 +1318,17 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
 	 * Sanity check the given block size
 	 */
 	switch (capbuf.blocklen) {
-	case 512:
-	case 1024:
-	case 2048:
-	case 4096:
+	case __constant_cpu_to_be32(512):
+	case __constant_cpu_to_be32(1024):
+	case __constant_cpu_to_be32(2048):
+	case __constant_cpu_to_be32(4096):
 		break;
 	default:
 		printk(KERN_ERR "%s: weird block size %u\n",
 			drive->name, capbuf.blocklen);
 		printk(KERN_ERR "%s: default to 2kb block size\n",
 			drive->name);
-		capbuf.blocklen = 2048;
+		capbuf.blocklen = __constant_cpu_to_be32(2048);
 		break;
 	}
 
Signature · 1 line
1.5.6.4.570.g052e
#1 lore raw
Quoted 3 lines · Harvey Harrison

Noticed by sparse between next-20080722 and next-20080723

Thanks for noticing/fixing this.

I integrated it into the guilty patch
("ide-cd: fix oops when using growisofs").

Quoted 33 lines
---
 drivers/ide/ide-cd.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/ide/ide-cd.c +5 -5
index 3a6fef5..a384500 100644
@@ -1318,17 +1318,17 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
 	 * Sanity check the given block size
 	 */
 	switch (capbuf.blocklen) {
-	case 512:
-	case 1024:
-	case 2048:
-	case 4096:
+	case __constant_cpu_to_be32(512):
+	case __constant_cpu_to_be32(1024):
+	case __constant_cpu_to_be32(2048):
+	case __constant_cpu_to_be32(4096):
 		break;
 	default:
 		printk(KERN_ERR "%s: weird block size %u\n",
 			drive->name, capbuf.blocklen);
 		printk(KERN_ERR "%s: default to 2kb block size\n",
 			drive->name);
-		capbuf.blocklen = 2048;
+		capbuf.blocklen = __constant_cpu_to_be32(2048);
 		break;
 	}
 
Signature · 1 line
1.5.6.4.570.g052e
#2 lore raw
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines · Harvey Harrison

Noticed by sparse between next-20080722 and next-20080723

Thanks for noticing/fixing this.

I integrated it into the guilty patch
("ide-cd: fix oops when using growisofs").

This is precisely why I'm running sparse on each linux-next, so no worries.

Harvey

#3 lore raw

Hi Harvey,

Quoted 3 lines · On Thu, 24 Jul 2008 12:16:57 -0700 Harvey Harrison <[email protected]>…

This is precisely why I'm running sparse on each linux-next, so no worries.

Thanks Harvey, that is a great addition to the testing.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/