linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bluetooth:master 230/240] net/bluetooth/a2mp.c:358:2: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int'
@ 2012-09-28  1:17 Fengguang Wu
  2012-09-28 11:41 ` [PATCH] Bluetooth: A2MP: Correct assoc_len size Andrei Emeltchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Fengguang Wu @ 2012-09-28  1:17 UTC (permalink / raw)
  To: Andrei Emeltchenko
  Cc: Yuanhan Liu, kernel-janitors, Gustavo Padovan, linux-bluetooth

Hi Andrei,

FYI, there are new compile warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
head:   392f44d3e7894f6fe314b85b4a1611b7b1d98226
commit: 9a5e94dbb4aa306742a47cbbcb0a44d4fc77a9e4 [230/240] Bluetooth: A2MP: Process A2MP Get AMP Assoc Rsp
config: x86_64-allmodconfig

All warnings:

net/bluetooth/a2mp.c: In function 'a2mp_getampassoc_rsp':
net/bluetooth/a2mp.c:358:2: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Wformat]

vim +358 net/bluetooth/a2mp.c

9a5e94db (Andrei Emeltchenko 2012-09-27  346) static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
9a5e94db (Andrei Emeltchenko 2012-09-27  347) 				struct a2mp_cmd *hdr)
9a5e94db (Andrei Emeltchenko 2012-09-27  348) {
9a5e94db (Andrei Emeltchenko 2012-09-27  349) 	struct a2mp_amp_assoc_rsp *rsp = (void *) skb->data;
9a5e94db (Andrei Emeltchenko 2012-09-27  350) 	u16 len = le16_to_cpu(hdr->len);
9a5e94db (Andrei Emeltchenko 2012-09-27  351) 	struct hci_dev *hdev;
9a5e94db (Andrei Emeltchenko 2012-09-27  352) 	struct amp_ctrl *ctrl;
9a5e94db (Andrei Emeltchenko 2012-09-27  353) 	struct hci_conn *hcon;
9a5e94db (Andrei Emeltchenko 2012-09-27  354) 
9a5e94db (Andrei Emeltchenko 2012-09-27  355) 	if (len < sizeof(*rsp))
9a5e94db (Andrei Emeltchenko 2012-09-27  356) 		return -EINVAL;
9a5e94db (Andrei Emeltchenko 2012-09-27  357) 
9a5e94db (Andrei Emeltchenko 2012-09-27 @358) 	BT_DBG("id %d status 0x%2.2x assoc len %u", rsp->id, rsp->status,
9a5e94db (Andrei Emeltchenko 2012-09-27  359) 	       len - sizeof(*rsp));
9a5e94db (Andrei Emeltchenko 2012-09-27  360) 
9a5e94db (Andrei Emeltchenko 2012-09-27  361) 	if (rsp->status)
9a5e94db (Andrei Emeltchenko 2012-09-27  362) 		return -EINVAL;

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu, Yuanhan Liu                              Intel Corporation

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

* [PATCH] Bluetooth: A2MP: Correct assoc_len size
  2012-09-28  1:17 [bluetooth:master 230/240] net/bluetooth/a2mp.c:358:2: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' Fengguang Wu
@ 2012-09-28 11:41 ` Andrei Emeltchenko
  2012-09-28 13:55   ` [PATCHv2] " Andrei Emeltchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Andrei Emeltchenko @ 2012-09-28 11:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Correct assoc_len and fix warning for x86-64 by using %zu specifier
reported by Fengguang Wu <fengguang.wu@intel.com>.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/a2mp.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index a55449e..82ccedf 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -381,12 +381,15 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	struct hci_dev *hdev;
 	struct amp_ctrl *ctrl;
 	struct hci_conn *hcon;
+	u16 assoc_len;
 
 	if (len < sizeof(*rsp))
 		return -EINVAL;
 
-	BT_DBG("id %d status 0x%2.2x assoc len %lu", rsp->id, rsp->status,
-	       len - sizeof(*rsp));
+	assoc_len = len - sizeof(*rsp);
+
+	BT_DBG("id %d status 0x%2.2x assoc len %zu", rsp->id, rsp->status,
+	       assoc_len);
 
 	if (rsp->status)
 		return -EINVAL;
@@ -394,7 +397,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	/* Save remote ASSOC data */
 	ctrl = amp_ctrl_lookup(mgr, rsp->id);
 	if (ctrl) {
-		u8 *assoc, assoc_len = len - sizeof(*rsp);
+		u8 *assoc;
 
 		assoc = kzalloc(assoc_len, GFP_KERNEL);
 		if (!assoc) {
@@ -468,7 +471,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 	}
 
 	if (ctrl) {
-		u8 *assoc, assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
+		u16 assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
+		u8 *assoc;
 
 		ctrl->id = rsp.remote_id;
 
-- 
1.7.9.5


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

* [PATCHv2] Bluetooth: A2MP: Correct assoc_len size
  2012-09-28 11:41 ` [PATCH] Bluetooth: A2MP: Correct assoc_len size Andrei Emeltchenko
@ 2012-09-28 13:55   ` Andrei Emeltchenko
  2012-09-28 15:53     ` Gustavo Padovan
  0 siblings, 1 reply; 4+ messages in thread
From: Andrei Emeltchenko @ 2012-09-28 13:55 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Correct assoc_len and fix warning for x86-64 by using %zu specifier
reported by Fengguang Wu <fengguang.wu@intel.com>.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
	v2: make assoc_len type of size_t
 net/bluetooth/a2mp.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index a55449e..d4946b5 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -381,12 +381,15 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	struct hci_dev *hdev;
 	struct amp_ctrl *ctrl;
 	struct hci_conn *hcon;
+	size_t assoc_len;
 
 	if (len < sizeof(*rsp))
 		return -EINVAL;
 
-	BT_DBG("id %d status 0x%2.2x assoc len %lu", rsp->id, rsp->status,
-	       len - sizeof(*rsp));
+	assoc_len = len - sizeof(*rsp);
+
+	BT_DBG("id %d status 0x%2.2x assoc len %zu", rsp->id, rsp->status,
+	       assoc_len);
 
 	if (rsp->status)
 		return -EINVAL;
@@ -394,7 +397,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	/* Save remote ASSOC data */
 	ctrl = amp_ctrl_lookup(mgr, rsp->id);
 	if (ctrl) {
-		u8 *assoc, assoc_len = len - sizeof(*rsp);
+		u8 *assoc;
 
 		assoc = kzalloc(assoc_len, GFP_KERNEL);
 		if (!assoc) {
@@ -468,7 +471,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 	}
 
 	if (ctrl) {
-		u8 *assoc, assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
+		size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
+		u8 *assoc;
 
 		ctrl->id = rsp.remote_id;
 
-- 
1.7.9.5


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

* Re: [PATCHv2] Bluetooth: A2MP: Correct assoc_len size
  2012-09-28 13:55   ` [PATCHv2] " Andrei Emeltchenko
@ 2012-09-28 15:53     ` Gustavo Padovan
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2012-09-28 15:53 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-09-28 16:55:00 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> Correct assoc_len and fix warning for x86-64 by using %zu specifier
> reported by Fengguang Wu <fengguang.wu@intel.com>.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> 	v2: make assoc_len type of size_t
>  net/bluetooth/a2mp.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Patch has been applied to bluetooth-next, Thanks.

	Gustavo

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

end of thread, other threads:[~2012-09-28 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28  1:17 [bluetooth:master 230/240] net/bluetooth/a2mp.c:358:2: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' Fengguang Wu
2012-09-28 11:41 ` [PATCH] Bluetooth: A2MP: Correct assoc_len size Andrei Emeltchenko
2012-09-28 13:55   ` [PATCHv2] " Andrei Emeltchenko
2012-09-28 15:53     ` 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).