* [linux-next:master 4793/7299] drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup
@ 2021-03-25 15:49 kernel test robot
2021-03-25 15:49 ` [PATCH] HID: fix memdup.cocci warnings kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-03-25 15:49 UTC (permalink / raw)
To: Dario Pagani
Cc: kbuild-all, Linux Memory Management List, Jiri Kosina, Kim Kuparinen
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: b4f20b70784aabf97e1727561e775500f6e294c7
commit: c49c33637802a2c6957a78119eb8be3b055dd9e9 [4793/7299] HID: support for initialization of some Thrustmaster wheels
config: nds32-randconfig-c003-20210325 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cocci warnings: (new ones prefixed by >>)
>> drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup
Please review and possibly fold the followup patch.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30687 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] HID: fix memdup.cocci warnings
2021-03-25 15:49 [linux-next:master 4793/7299] drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup kernel test robot
@ 2021-03-25 15:49 ` kernel test robot
2021-03-30 7:44 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-03-25 15:49 UTC (permalink / raw)
To: Dario Pagani
Cc: kbuild-all, Linux Memory Management List, Jiri Kosina, Kim Kuparinen
From: kernel test robot <lkp@intel.com>
drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup
Use kmemdup rather than duplicating its implementation
Generated by: scripts/coccinelle/api/memdup.cocci
Fixes: c49c33637802 ("HID: support for initialization of some Thrustmaster wheels")
CC: Dario Pagani <dario.pagani.146@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: b4f20b70784aabf97e1727561e775500f6e294c7
commit: c49c33637802a2c6957a78119eb8be3b055dd9e9 [4793/7299] HID: support for initialization of some Thrustmaster wheels
hid-thrustmaster.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/hid/hid-thrustmaster.c
+++ b/drivers/hid/hid-thrustmaster.c
@@ -297,12 +297,13 @@ static int thrustmaster_probe(struct hid
goto error2;
}
- tm_wheel->model_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ tm_wheel->model_request = kmemdup(&model_request,
+ sizeof(struct usb_ctrlrequest),
+ GFP_KERNEL);
if (!tm_wheel->model_request) {
ret = -ENOMEM;
goto error3;
}
- memcpy(tm_wheel->model_request, &model_request, sizeof(struct usb_ctrlrequest));
tm_wheel->response = kzalloc(sizeof(struct tm_wheel_response), GFP_KERNEL);
if (!tm_wheel->response) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: fix memdup.cocci warnings
2021-03-25 15:49 ` [PATCH] HID: fix memdup.cocci warnings kernel test robot
@ 2021-03-30 7:44 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2021-03-30 7:44 UTC (permalink / raw)
To: kernel test robot
Cc: Dario Pagani, kbuild-all, Linux Memory Management List, Kim Kuparinen
On Thu, 25 Mar 2021, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
>
> drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup
>
> Use kmemdup rather than duplicating its implementation
>
> Generated by: scripts/coccinelle/api/memdup.cocci
>
> Fixes: c49c33637802 ("HID: support for initialization of some Thrustmaster wheels")
> CC: Dario Pagani <dario.pagani.146@gmail.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
Applied.
--
Jiri Kosina
Director, SUSE Labs Core
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-30 7:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 15:49 [linux-next:master 4793/7299] drivers/hid/hid-thrustmaster.c:300:27-34: WARNING opportunity for kmemdup kernel test robot
2021-03-25 15:49 ` [PATCH] HID: fix memdup.cocci warnings kernel test robot
2021-03-30 7:44 ` 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).