* [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
@ 2009-07-08 18:44 Bing Zhao
2009-07-08 18:54 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2009-07-08 18:44 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bing Zhao
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>
---
This patch is for bluetooth-mrvl-2.6.git tree.
It has been tested on both 32-bit and 64-bit x86 laptops.
drivers/bluetooth/btmrvl_sdio.c | 12 +++++++-----
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 224af53..1cfa8b4 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)
goto exit;
}
- if ((u32) skb->data & (BTSDIO_DMA_ALIGN - 1)) {
- skb_put(skb, (u32) skb->data & (BTSDIO_DMA_ALIGN - 1));
- skb_pull(skb, (u32) skb->data & (BTSDIO_DMA_ALIGN - 1));
+ if ((unsigned long) skb->data & (BTSDIO_DMA_ALIGN - 1)) {
+ skb_put(skb, (unsigned long) skb->data &
+ (BTSDIO_DMA_ALIGN - 1));
+ skb_pull(skb, (unsigned long) skb->data &
+ (BTSDIO_DMA_ALIGN - 1));
}
- payload = skb->tail;
+ payload = skb->data;
ret = sdio_readsb(card->func, payload, card->ioport,
buf_block_len * blksz);
@@ -773,7 +775,7 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
}
buf = payload;
- if ((u32) payload & (BTSDIO_DMA_ALIGN - 1)) {
+ if ((unsigned long) payload & (BTSDIO_DMA_ALIGN - 1)) {
tmpbufsz = ALIGN_SZ(nb, BTSDIO_DMA_ALIGN);
tmpbuf = kmalloc(tmpbufsz, GFP_KERNEL);
memset(tmpbuf, 0, tmpbufsz);
diff --git a/drivers/bluetooth/btmrvl_sdio.h b/drivers/bluetooth/btmrvl_sdio.h
index 2dd284e..27329f1 100644
--- a/drivers/bluetooth/btmrvl_sdio.h
+++ b/drivers/bluetooth/btmrvl_sdio.h
@@ -104,4 +104,5 @@ struct btmrvl_sdio_device {
/* Macros for Data Alignment : address */
#define ALIGN_ADDR(p, a) \
- ((((u32)(p)) + (((u32)(a)) - 1)) & ~(((u32)(a)) - 1))
+ ((((unsigned long)(p)) + (((unsigned long)(a)) - 1)) & \
+ ~(((unsigned long)(a)) - 1))
--
1.5.3.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
2009-07-08 18:44 [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver Bing Zhao
@ 2009-07-08 18:54 ` Marcel Holtmann
2009-07-13 18:06 ` Bing Zhao
0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2009-07-08 18:54 UTC (permalink / raw)
To: Bing Zhao; +Cc: linux-bluetooth
Hi Bing,
> 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.
I pushed that patch into the bluetooth-mrvl-2.6 tree now.
However I am pretty sure that are better "Linux" ways on handling the
alignment for the SKBs.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
2009-07-08 18:54 ` Marcel Holtmann
@ 2009-07-13 18:06 ` Bing Zhao
2009-07-14 2:26 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2009-07-13 18:06 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
Hi Marcel,
This patch fixed the alignment issue and the compilation warnings on 64-bit=
system.
I also tested some basic commands (scan, l2ping, etc.) on my 64-bit HP lapt=
op and they seem working fine.
Should you have any other commands for testing/verification, or items for c=
leanup please let me know.
Thanks much for your help.
Bing
> -----Original Message-----
> From: Marcel Holtmann [mailto:marcel@holtmann.org]
> Sent: Wednesday, July 08, 2009 11:54 AM
> To: Bing Zhao
> Cc: linux-bluetooth@vger.kernel.org
> Subject: Re: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-ove=
r-SDIO driver
>=20
> Hi Bing,
>=20
> > 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.
>=20
> I pushed that patch into the bluetooth-mrvl-2.6 tree now.
>=20
> However I am pretty sure that are better "Linux" ways on handling the
> alignment for the SKBs.
>=20
> Regards
>=20
> Marcel
>=20
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
2009-07-13 18:06 ` Bing Zhao
@ 2009-07-14 2:26 ` Marcel Holtmann
2009-07-14 4:20 ` Bing Zhao
0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2009-07-14 2:26 UTC (permalink / raw)
To: Bing Zhao; +Cc: linux-bluetooth@vger.kernel.org
Hi Bing,
not top-posting please. This is an open source mailing list. We do
things the right way.
> This patch fixed the alignment issue and the compilation warnings on 64-bit system.
> I also tested some basic commands (scan, l2ping, etc.) on my 64-bit HP laptop and they seem working fine.
>
> Should you have any other commands for testing/verification, or items for cleanup please let me know.
I pushed bluetooth-mrvl-2.6 into bluetooth-next-2.6 to see if any build
fallouts come up.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver
2009-07-14 2:26 ` Marcel Holtmann
@ 2009-07-14 4:20 ` Bing Zhao
0 siblings, 0 replies; 5+ messages in thread
From: Bing Zhao @ 2009-07-14 4:20 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
Hi Marcel,
> -----Original Message-----
> From: Marcel Holtmann [mailto:marcel@holtmann.org]
> Sent: Monday, July 13, 2009 7:27 PM
> To: Bing Zhao
> Cc: linux-bluetooth@vger.kernel.org
> Subject: RE: [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-ove=
r-SDIO driver
>=20
> Hi Bing,
>=20
> not top-posting please. This is an open source mailing list. We do
> things the right way.
Sorry about that.
> > This patch fixed the alignment issue and the compilation warnings on 64=
-bit system.
> > I also tested some basic commands (scan, l2ping, etc.) on my 64-bit HP =
laptop and they seem working
> fine.
> >
> > Should you have any other commands for testing/verification, or items f=
or cleanup please let me
> know.
>=20
> I pushed bluetooth-mrvl-2.6 into bluetooth-next-2.6 to see if any build
> fallouts come up.
Thanks! I'll clone bluetooth-next-2.6 tree for testing and future changes.
Bing
> Regards
>=20
> Marcel
>=20
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-14 4:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-08 18:44 [PATCH] Bluetooth: Fix incorrect alignment in Marvell BT-over-SDIO driver Bing Zhao
2009-07-08 18:54 ` Marcel Holtmann
2009-07-13 18:06 ` Bing Zhao
2009-07-14 2:26 ` Marcel Holtmann
2009-07-14 4:20 ` Bing Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox