linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix wrong memcpy size on LE start encryption
@ 2011-09-19 18:41 anderson.briglia
  2011-09-19 19:45 ` Gustavo Padovan
  0 siblings, 1 reply; 2+ messages in thread
From: anderson.briglia @ 2011-09-19 18:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia, Anderson Lizardo

From: Anderson Briglia <anderson.briglia@openbossa.org>

This patch fixes wrong memcpy size when copying rand value to
HCI_OP_LE_START_ENC command.
The compiler pretends that the array parameter was declared as a pointer
and sizeof reports the size of the pointer. [1]

[1] http://www.c-faq.com/aryptr/aryparmsize.html

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
---
 net/bluetooth/hci_conn.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index ea7f031..c2df7bf 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -218,7 +218,7 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
 	cp.handle = cpu_to_le16(conn->handle);
 	memcpy(cp.ltk, ltk, sizeof(cp.ltk));
 	cp.ediv = ediv;
-	memcpy(cp.rand, rand, sizeof(rand));
+	memcpy(cp.rand, rand, sizeof(cp.rand));
 
 	hci_send_cmd(hdev, HCI_OP_LE_START_ENC, sizeof(cp), &cp);
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: Fix wrong memcpy size on LE start encryption
  2011-09-19 18:41 [PATCH] Bluetooth: Fix wrong memcpy size on LE start encryption anderson.briglia
@ 2011-09-19 19:45 ` Gustavo Padovan
  0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Padovan @ 2011-09-19 19:45 UTC (permalink / raw)
  To: anderson.briglia; +Cc: linux-bluetooth, Anderson Lizardo

* anderson.briglia@openbossa.org <anderson.briglia@openbossa.org> [2011-09-19 14:41:09 -0400]:

> From: Anderson Briglia <anderson.briglia@openbossa.org>
> 
> This patch fixes wrong memcpy size when copying rand value to
> HCI_OP_LE_START_ENC command.
> The compiler pretends that the array parameter was declared as a pointer
> and sizeof reports the size of the pointer. [1]
> 
> [1] http://www.c-faq.com/aryptr/aryparmsize.html
> 
> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
> ---
>  net/bluetooth/hci_conn.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-19 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-19 18:41 [PATCH] Bluetooth: Fix wrong memcpy size on LE start encryption anderson.briglia
2011-09-19 19:45 ` Gustavo Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).