Skip to contentSkip to conversation

FIx crash in mmc_block on 64-bit

PATCH In review Ben Collins 2 participants 3 messages Jun 2, 2008 – Jun 5, 2008 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FIx crash in mmc_block on 64-bit

Fairly simple. "dev_use" was being allocated as a zero length array because of bad math on 64-bit systems causing a crash in find_first_zero_bit(). One-liner follows:

drivers/mmc/card/block.c +1 -1
index 91ded3e..f9ad960 100644
@@ -46,7 +46,7 @@
 #define MMC_SHIFT	3
 #define MMC_NUM_MINORS	(256 >> MMC_SHIFT)
 
-static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];
+static DECLARE_BITMAP(dev_use, MMC_NUM_MINORS);
 
 /*
  * There is one mmc_blk_data per slot.
#1 lore raw
Quoted 4 lines · On Mon, 02 Jun 2008 13:39:19 -0400 Ben Collins <[email protected]>…

Fairly simple. "dev_use" was being allocated as a zero length array because of bad math on 64-bit systems causing a crash in find_first_zero_bit(). One-liner follows:

A signed-off-by to make things nice and proper, please. :)

You can add an Acked-by: Pierre Ossman <[email protected]> and pass it on directly to Linus.

Rgds

Signature · 4 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org
#2 lore raw
Quoted 8 lines · Pierre Ossman
Quoted 4 lines · On Mon, 02 Jun 2008 13:39:19 -0400 Ben Collins <[email protected]>…

Fairly simple. "dev_use" was being allocated as a zero length array because of bad math on 64-bit systems causing a crash in find_first_zero_bit(). One-liner follows:

Quoted 4 lines

A signed-off-by to make things nice and proper, please. :)

You can add an Acked-by: Pierre Ossman <[email protected]> and pass it on directly to Linus.

Not sure how I missed the signed-off-by, but resent to Linus with your ack. Thanks