drivers/thunderbolt/dma_test.c:302:13-20: WARNING opportunity for kmemdup
Subsystems (2)
kernel test robot
build botCC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4 head: 694851c854b7836ffd9c561ae548fe4dc33d1218 commit: e56d76e37b90ac29385f47c0f102d79be1dacad4 [25/35] FROMGIT: thunderbolt: Add DMA traffic test driver
:::::: branch date: 2 hours ago
:::::: commit date: 20 hours ago
config: x86_64-randconfig-c002-20201117 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
"coccinelle warnings: (new ones prefixed by >>)"
>> drivers/thunderbolt/dma_test.c:302:13-20: 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(a)lists.01.org
kernel test robot
build bot[PATCH] FROMGIT: thunderbolt: fix memdup.cocci warnings
CC: kbuild-all(a)lists.01.org TO: cros-kernel-buildreports(a)googlegroups.com TO: Guenter Roeck <[email protected]>
CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>
From: kernel test robot <[email protected]>
drivers/thunderbolt/dma_test.c:302:13-20: WARNING opportunity for kmemdup
Use kmemdup rather than duplicating its implementation
Generated by: scripts/coccinelle/api/memdup.cocci
---
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4 head: 694851c854b7836ffd9c561ae548fe4dc33d1218 commit: e56d76e37b90ac29385f47c0f102d79be1dacad4 [25/35] FROMGIT: thunderbolt: Add DMA traffic test driver
:::::: branch date: 2 hours ago
:::::: commit date: 20 hours ago
Please take the patch only if it's a positive warning. Thanks!
dma_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/thunderbolt/dma_test.c +2 -3
@@ -299,14 +299,13 @@ static int dma_test_submit_tx(struct dma tf->frame.size =0 ;/* means 4096 */ tf->dma_test = dt; - tf->data =kzalloc (DMA_TEST_FRAME_SIZE ,GFP_KERNEL ); + tf->data =kmemdup (dma_test_pattern,DMA_TEST_FRAME_SIZE , +GFP_KERNEL );if (!tf->data) {kfree (tf);return -ENOMEM ; } -memcpy (tf->data, dma_test_pattern,DMA_TEST_FRAME_SIZE ); - dma_addr =dma_map_single (dma_dev, tf->data,DMA_TEST_FRAME_SIZE ,DMA_TO_DEVICE );if (dma_mapping_error (dma_dev, dma_addr)) {