Re: [PATCH] staging: gdm724x: Fix DMA from stack

From: kernel test robot
Date: Tue Feb 09 2021 - 12:23:43 EST


Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url: https://github.com/0day-ci/linux/commits/ameynarkhede03-gmail-com/staging-gdm724x-Fix-DMA-from-stack/20210209-225530
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 06b0c0dce88e2aa2f01343db0f26d214d7f264a0
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d793f4f05736924fc2207a0f8c338115523930da
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ameynarkhede03-gmail-com/staging-gdm724x-Fix-DMA-from-stack/20210209-225530
git checkout d793f4f05736924fc2207a0f8c338115523930da
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:10,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/staging/gdm724x/gdm_usb.c:6:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
drivers/staging/gdm724x/gdm_usb.c: In function 'request_mac_address':
>> drivers/staging/gdm724x/gdm_usb.c:60:21: warning: 'buf' is used uninitialized in this function [-Wuninitialized]
60 | struct hci_packet *hci = (struct hci_packet *)buf;
| ^~~


vim +/buf +60 drivers/staging/gdm724x/gdm_usb.c

61e12104764512 Won Kang 2013-07-25 50
61e12104764512 Won Kang 2013-07-25 51 static int gdm_usb_recv(void *priv_dev,
35db0350c5ef0d Aybuke Ozdemir 2014-03-14 52 int (*cb)(void *cb_data,
35db0350c5ef0d Aybuke Ozdemir 2014-03-14 53 void *data, int len, int context),
61e12104764512 Won Kang 2013-07-25 54 void *cb_data,
61e12104764512 Won Kang 2013-07-25 55 int context);
61e12104764512 Won Kang 2013-07-25 56
61e12104764512 Won Kang 2013-07-25 57 static int request_mac_address(struct lte_udev *udev)
61e12104764512 Won Kang 2013-07-25 58 {
d793f4f0573692 Amey Narkhede 2021-02-09 59 u8 *buf;
61e12104764512 Won Kang 2013-07-25 @60 struct hci_packet *hci = (struct hci_packet *)buf;
61e12104764512 Won Kang 2013-07-25 61 struct usb_device *usbdev = udev->usbdev;
61e12104764512 Won Kang 2013-07-25 62 int actual;
61e12104764512 Won Kang 2013-07-25 63 int ret = -1;
61e12104764512 Won Kang 2013-07-25 64
1b5e56ece3f501 Quytelda Kahja 2018-02-22 65 hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION);
1b5e56ece3f501 Quytelda Kahja 2018-02-22 66 hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1);
61e12104764512 Won Kang 2013-07-25 67 hci->data[0] = MAC_ADDRESS;
61e12104764512 Won Kang 2013-07-25 68
d793f4f0573692 Amey Narkhede 2021-02-09 69 buf = kmalloc(16, GFP_KERNEL);
d793f4f0573692 Amey Narkhede 2021-02-09 70 if (!buf)
d793f4f0573692 Amey Narkhede 2021-02-09 71 return -ENOMEM;
d793f4f0573692 Amey Narkhede 2021-02-09 72
61e12104764512 Won Kang 2013-07-25 73 ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5,
61e12104764512 Won Kang 2013-07-25 74 &actual, 1000);
61e12104764512 Won Kang 2013-07-25 75
61e12104764512 Won Kang 2013-07-25 76 udev->request_mac_addr = 1;
61e12104764512 Won Kang 2013-07-25 77
61e12104764512 Won Kang 2013-07-25 78 return ret;
61e12104764512 Won Kang 2013-07-25 79 }
61e12104764512 Won Kang 2013-07-25 80

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip