diskio: add a paranoia cast
authorH. Peter Anvin <hpa@zytor.com>
Sat, 17 Jul 2010 19:40:01 +0000 (12:40 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sat, 17 Jul 2010 19:40:01 +0000 (12:40 -0700)
Make sure we don't overflow the shift, even though that should never
be possible.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/fs/diskio.c

index 449e12c..481b59b 100644 (file)
@@ -12,7 +12,7 @@
 
 static inline sector_t chs_max(const struct disk *disk)
 {
-    return disk->secpercyl << 10;
+    return (sector_t)disk->secpercyl << 10;
 }
 
 static int chs_rdwr_sectors(struct disk *disk, void *buf,