diff options
author | Bing Zhao <bzhao@marvell.com> | 2009-07-08 14:44:14 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-08-22 17:25:34 -0400 |
commit | 3318b2362bf0528be77123c480249663557dfbfc (patch) | |
tree | b0d06465c9663d0f3f958c603feade942dd50e56 /drivers | |
parent | 9374253ffe609f2d70dd5ae280182cb6f08fef08 (diff) |
Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
The driver uses "u32" for alignment check and calculation which
works only on 32-bit system. It will crash the 64-bit system.
Replace "u32" with "unsigned long" to fix this issue.
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/bluetooth/btmrvl_sdio.c | 12 | ||||
-rw-r--r-- | drivers/bluetooth/btmrvl_sdio.h | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 224af53e0fae..1cfa8b4ace50 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
@@ -481,12 +481,14 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) | |||
481 | goto exit; | 481 | goto exit; |
482 | } | 482 | } |
483 | 483 | ||
484 | if ((u32) skb->data & (BTSDIO_DMA_ALIGN - 1)) { | 484 | if ((unsigned long) skb->data & (BTSDIO_DMA_ALIGN - 1)) { |
485 | skb_put(skb, (u32) skb->data & (BTSDIO_DMA_ALIGN - 1)); | 485 | skb_put(skb, (unsigned long) skb->data & |
486 | skb_pull(skb, (u32) skb->data & (BTSDIO_DMA_ALIGN - 1)); | 486 | (BTSDIO_DMA_ALIGN - 1)); |
487 | skb_pull(skb, (unsigned long) skb->data & | ||
488 | (BTSDIO_DMA_ALIGN - 1)); | ||
487 | } | 489 | } |
488 | 490 | ||
489 | payload = skb->tail; | 491 | payload = skb->data; |
490 | 492 | ||
491 | ret = sdio_readsb(card->func, payload, card->ioport, | 493 | ret = sdio_readsb(card->func, payload, card->ioport, |
492 | buf_block_len * blksz); | 494 | buf_block_len * blksz); |
@@ -773,7 +775,7 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv, | |||
773 | } | 775 | } |
774 | 776 | ||
775 | buf = payload; | 777 | buf = payload; |
776 | if ((u32) payload & (BTSDIO_DMA_ALIGN - 1)) { | 778 | if ((unsigned long) payload & (BTSDIO_DMA_ALIGN - 1)) { |
777 | tmpbufsz = ALIGN_SZ(nb, BTSDIO_DMA_ALIGN); | 779 | tmpbufsz = ALIGN_SZ(nb, BTSDIO_DMA_ALIGN); |
778 | tmpbuf = kmalloc(tmpbufsz, GFP_KERNEL); | 780 | tmpbuf = kmalloc(tmpbufsz, GFP_KERNEL); |
779 | memset(tmpbuf, 0, tmpbufsz); | 781 | memset(tmpbuf, 0, tmpbufsz); |
diff --git a/drivers/bluetooth/btmrvl_sdio.h b/drivers/bluetooth/btmrvl_sdio.h index 2dd284e0df14..27329f107e5a 100644 --- a/drivers/bluetooth/btmrvl_sdio.h +++ b/drivers/bluetooth/btmrvl_sdio.h | |||
@@ -104,4 +104,5 @@ struct btmrvl_sdio_device { | |||
104 | 104 | ||
105 | /* Macros for Data Alignment : address */ | 105 | /* Macros for Data Alignment : address */ |
106 | #define ALIGN_ADDR(p, a) \ | 106 | #define ALIGN_ADDR(p, a) \ |
107 | ((((u32)(p)) + (((u32)(a)) - 1)) & ~(((u32)(a)) - 1)) | 107 | ((((unsigned long)(p)) + (((unsigned long)(a)) - 1)) & \ |
108 | ~(((unsigned long)(a)) - 1)) | ||