Skip to contentSkip to conversation

fix 2.4 BLK_BOUNCE_ANY

PATCH William Lee Irwin III 1 participant 1 message Dec 8, 2003 Block layer

lore
Share & tools
lore
#0 lore raw

The bitshift defining BLK_BOUNCE_ANY can overflow. This patch casts to u64 before shifting there as well as in BLK_BOUNCE_HIGH to ensure integer overflow does not occur.

Originally discovered by Zwane Mwaikambo during pgcl development, submitted by me to mainline to 2.6, and already included in 2.6.

-- wli

===== include/linux/blkdev.h 1.25 vs edited =====

include/linux/blkdev.h +2 -2
@@ -176,8 +176,8 @@
 
 extern unsigned long blk_max_low_pfn, blk_max_pfn;
 
-#define BLK_BOUNCE_HIGH		(blk_max_low_pfn << PAGE_SHIFT)
-#define BLK_BOUNCE_ANY		(blk_max_pfn << PAGE_SHIFT)
+#define BLK_BOUNCE_HIGH		((u64)blk_max_low_pfn << PAGE_SHIFT)
+#define BLK_BOUNCE_ANY		((u64)blk_max_pfn << PAGE_SHIFT)
 
 extern void blk_queue_bounce_limit(request_queue_t *, u64);