linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [hid:for-4.8/alps 1/2] drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer
@ 2016-06-18 12:13 kbuild test robot
       [not found] ` <201606182012.7NLmbFhz%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2016-06-18 12:13 UTC (permalink / raw)
  Cc: kbuild-all, linux-input, linux-usb, Jiri Kosina, Masaki Ota

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git for-4.8/alps
head:   41f61ecc501ca970ae8d9955c57405dc4abfab5a
commit: 2562756dde550901c224e3805102bdfc17e7d13a [1/2] HID: add Alps I2C HID Touchpad-Stick support


coccinelle warnings: (new ones prefixed by >>)

>> drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer
   drivers/hid/hid-alps.c:148:4-10: ERROR: application of sizeof to pointer

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* [PATCH] HID: fix noderef.cocci warnings
       [not found] ` <201606182012.7NLmbFhz%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-06-18 12:13   ` kbuild test robot
  2016-06-20  9:45     ` Masaki Ota
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2016-06-18 12:13 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Jiri Kosina, Masaki Ota

drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer
drivers/hid/hid-alps.c:148:4-10: ERROR: application of sizeof to pointer

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

CC: Masaki Ota <masaki.ota-Ej8lA1M1qLxBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Fengguang Wu <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---

 hid-alps.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -136,7 +136,8 @@ static int u1_read_write_register(struct
 
 	input[7] = check_sum;
 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
-			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+			sizeof(*input), HID_FEATURE_REPORT,
+			HID_REQ_SET_REPORT);
 
 	if (ret < 0) {
 		dev_err(&hdev->dev, "failed to read command (%d)\n", ret);
@@ -145,7 +146,7 @@ static int u1_read_write_register(struct
 
 	if (read_flag) {
 		ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf,
-				sizeof(readbuf), HID_FEATURE_REPORT,
+				sizeof(*readbuf), HID_FEATURE_REPORT,
 				HID_REQ_GET_REPORT);
 
 		if (ret < 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH] HID: fix noderef.cocci warnings
  2016-06-18 12:13   ` [PATCH] HID: fix noderef.cocci warnings kbuild test robot
@ 2016-06-20  9:45     ` Masaki Ota
  2016-06-20 10:02       ` Fengguang Wu
       [not found]       ` <OSXPR01MB0408C44F44A1B06579D0BCB7C72A0-x3s0nd+sA3ZOfzQfux4QuHcolHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Masaki Ota @ 2016-06-20  9:45 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all@01.org, linux-input@vger.kernel.org,
	linux-usb@vger.kernel.org, Jiri Kosina

Hi, fengguang,

	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
-			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+			sizeof(*input), HID_FEATURE_REPORT,
+			HID_REQ_SET_REPORT);

I tested this code, but our device cannot work on it.
So, I think we should modify the code as below.

	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
			sizeof(u8)*U1_FEATURE_REPORT_LEN,
			HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

Best Regards,
Masaki Ota
-----Original Message-----
From: kbuild test robot [mailto:fengguang.wu@intel.com] 
Sent: Saturday, June 18, 2016 9:13 PM
Cc: kbuild-all@01.org; linux-input@vger.kernel.org; linux-usb@vger.kernel.org; Jiri Kosina; 太田 真喜 Masaki Ota
Subject: [PATCH] HID: fix noderef.cocci warnings

drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer
drivers/hid/hid-alps.c:148:4-10: ERROR: application of sizeof to pointer

 sizeof when applied to a pointer typed expression gives the size of  the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

CC: Masaki Ota <masaki.ota@jp.alps.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 hid-alps.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -136,7 +136,8 @@ static int u1_read_write_register(struct
 
 	input[7] = check_sum;
 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
-			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+			sizeof(*input), HID_FEATURE_REPORT,
+			HID_REQ_SET_REPORT);
 
 	if (ret < 0) {
 		dev_err(&hdev->dev, "failed to read command (%d)\n", ret); @@ -145,7 +146,7 @@ static int u1_read_write_register(struct
 
 	if (read_flag) {
 		ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf,
-				sizeof(readbuf), HID_FEATURE_REPORT,
+				sizeof(*readbuf), HID_FEATURE_REPORT,
 				HID_REQ_GET_REPORT);
 
 		if (ret < 0) {

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

* Re: [PATCH] HID: fix noderef.cocci warnings
  2016-06-20  9:45     ` Masaki Ota
@ 2016-06-20 10:02       ` Fengguang Wu
       [not found]       ` <OSXPR01MB0408C44F44A1B06579D0BCB7C72A0-x3s0nd+sA3ZOfzQfux4QuHcolHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Fengguang Wu @ 2016-06-20 10:02 UTC (permalink / raw)
  To: Masaki Ota
  Cc: kbuild-all@01.org, linux-input@vger.kernel.org,
	linux-usb@vger.kernel.org, Jiri Kosina

Hi Masaki,

On Mon, Jun 20, 2016 at 09:45:02AM +0000, Masaki Ota wrote:
> Hi, fengguang,
> 
> 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
> -			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
> +			sizeof(*input), HID_FEATURE_REPORT,
> +			HID_REQ_SET_REPORT);
> 
> I tested this code, but our device cannot work on it.
> So, I think we should modify the code as below.
> 
> 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
> 			sizeof(u8)*U1_FEATURE_REPORT_LEN,
> 			HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

OK, thank you for the fix!

Fenguang

> -----Original Message-----
> From: kbuild test robot [mailto:fengguang.wu@intel.com] 
> Sent: Saturday, June 18, 2016 9:13 PM
> Cc: kbuild-all@01.org; linux-input@vger.kernel.org; linux-usb@vger.kernel.org; Jiri Kosina; 太田 真喜 Masaki Ota
> Subject: [PATCH] HID: fix noderef.cocci warnings
> 
> drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer
> drivers/hid/hid-alps.c:148:4-10: ERROR: application of sizeof to pointer
> 
>  sizeof when applied to a pointer typed expression gives the size of  the pointer
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> CC: Masaki Ota <masaki.ota@jp.alps.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  hid-alps.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- a/drivers/hid/hid-alps.c
> +++ b/drivers/hid/hid-alps.c
> @@ -136,7 +136,8 @@ static int u1_read_write_register(struct
>  
>  	input[7] = check_sum;
>  	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
> -			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
> +			sizeof(*input), HID_FEATURE_REPORT,
> +			HID_REQ_SET_REPORT);
>  
>  	if (ret < 0) {
>  		dev_err(&hdev->dev, "failed to read command (%d)\n", ret); @@ -145,7 +146,7 @@ static int u1_read_write_register(struct
>  
>  	if (read_flag) {
>  		ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf,
> -				sizeof(readbuf), HID_FEATURE_REPORT,
> +				sizeof(*readbuf), HID_FEATURE_REPORT,
>  				HID_REQ_GET_REPORT);
>  
>  		if (ret < 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH] HID: fix noderef.cocci warnings
       [not found]       ` <OSXPR01MB0408C44F44A1B06579D0BCB7C72A0-x3s0nd+sA3ZOfzQfux4QuHcolHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2016-06-20 10:40         ` Jiri Kosina
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2016-06-20 10:40 UTC (permalink / raw)
  To: Masaki Ota
  Cc: kbuild test robot, kbuild-all-JC7UmRfGjtg@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Mon, 20 Jun 2016, Masaki Ota wrote:

> Hi, fengguang,
> 
> 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
> -			sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
> +			sizeof(*input), HID_FEATURE_REPORT,
> +			HID_REQ_SET_REPORT);

This is a wrong fix. sizeof(*input) is sizeof(u8).

> I tested this code, but our device cannot work on it.
> So, I think we should modify the code as below.
> 
> 	ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input,
> 			sizeof(u8)*U1_FEATURE_REPORT_LEN,
> 			HID_FEATURE_REPORT, HID_REQ_SET_REPORT);

I've already applied patch that fixes this (an one more callsite with the 
same issue); I CCed you on the patch earlier today.

-- 
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-06-20 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18 12:13 [hid:for-4.8/alps 1/2] drivers/hid/hid-alps.c:139:3-9: ERROR: application of sizeof to pointer kbuild test robot
     [not found] ` <201606182012.7NLmbFhz%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-18 12:13   ` [PATCH] HID: fix noderef.cocci warnings kbuild test robot
2016-06-20  9:45     ` Masaki Ota
2016-06-20 10:02       ` Fengguang Wu
     [not found]       ` <OSXPR01MB0408C44F44A1B06579D0BCB7C72A0-x3s0nd+sA3ZOfzQfux4QuHcolHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-06-20 10:40         ` Jiri Kosina

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).