* [linux-next:master 7654/8449] kernel/dma/map_benchmark.c:195:37: warning: variable 'argp' is uninitialized when used within its own initialization
@ 2020-11-26 1:42 kernel test robot
2020-11-26 1:45 ` Song Bao Hua (Barry Song)
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-11-26 1:42 UTC (permalink / raw)
To: Barry Song
Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
Christoph Hellwig
[-- Attachment #1: Type: text/plain, Size: 11036 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 9d3e48f20e1159a7bb2ff5de96594b6375157fe0
commit: bfd2defed94d3be843b0c2d3d6b13571c24b4c33 [7654/8449] dma-mapping: add benchmark support for streaming DMA APIs
config: s390-randconfig-r013-20201126 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 175ebad958a0ebaf6c56c20ab30b9d4347742c29)
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
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=bfd2defed94d3be843b0c2d3d6b13571c24b4c33
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout bfd2defed94d3be843b0c2d3d6b13571c24b4c33
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^
In file included from kernel/dma/map_benchmark.c:11:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:80:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
^
In file included from kernel/dma/map_benchmark.c:11:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:80:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
^
In file included from kernel/dma/map_benchmark.c:11:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:80:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
^
In file included from kernel/dma/map_benchmark.c:11:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:80:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
__fswab32(x))
^
In file included from kernel/dma/map_benchmark.c:11:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:80:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> kernel/dma/map_benchmark.c:195:37: warning: variable 'argp' is uninitialized when used within its own initialization [-Wuninitialized]
void __user *argp = (void __user *)argp;
~~~~ ^~~~
21 warnings generated.
vim +/argp +195 kernel/dma/map_benchmark.c
190
191 static long map_benchmark_ioctl(struct file *file, unsigned int cmd,
192 unsigned long arg)
193 {
194 struct map_benchmark_data *map = file->private_data;
> 195 void __user *argp = (void __user *)argp;
196 u64 old_dma_mask;
197
198 int ret;
199
200 if (copy_from_user(&map->bparam, argp, sizeof(map->bparam)))
201 return -EFAULT;
202
203 switch (cmd) {
204 case DMA_MAP_BENCHMARK:
205 if (map->bparam.threads == 0 ||
206 map->bparam.threads > DMA_MAP_MAX_THREADS) {
207 pr_err("invalid thread number\n");
208 return -EINVAL;
209 }
210
211 if (map->bparam.seconds == 0 ||
212 map->bparam.seconds > DMA_MAP_MAX_SECONDS) {
213 pr_err("invalid duration seconds\n");
214 return -EINVAL;
215 }
216
217 if (map->bparam.node != NUMA_NO_NODE &&
218 !node_possible(map->bparam.node)) {
219 pr_err("invalid numa node\n");
220 return -EINVAL;
221 }
222
223 switch (map->bparam.dma_dir) {
224 case DMA_MAP_BIDIRECTIONAL:
225 map->dir = DMA_BIDIRECTIONAL;
226 break;
227 case DMA_MAP_FROM_DEVICE:
228 map->dir = DMA_FROM_DEVICE;
229 break;
230 case DMA_MAP_TO_DEVICE:
231 map->dir = DMA_TO_DEVICE;
232 break;
233 default:
234 pr_err("invalid DMA direction\n");
235 return -EINVAL;
236 }
237
238 old_dma_mask = dma_get_mask(map->dev);
239
240 ret = dma_set_mask(map->dev,
241 DMA_BIT_MASK(map->bparam.dma_bits));
242 if (ret) {
243 pr_err("failed to set dma_mask on device %s\n",
244 dev_name(map->dev));
245 return -EINVAL;
246 }
247
248 ret = do_map_benchmark(map);
249
250 /*
251 * restore the original dma_mask as many devices' dma_mask are
252 * set by architectures, acpi, busses. When we bind them back
253 * to their original drivers, those drivers shouldn't see
254 * dma_mask changed by benchmark
255 */
256 dma_set_mask(map->dev, old_dma_mask);
257 break;
258 default:
259 return -EINVAL;
260 }
261
262 if (copy_to_user(argp, &map->bparam, sizeof(map->bparam)))
263 return -EFAULT;
264
265 return ret;
266 }
267
---
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: 28318 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [linux-next:master 7654/8449] kernel/dma/map_benchmark.c:195:37: warning: variable 'argp' is uninitialized when used within its own initialization
2020-11-26 1:42 [linux-next:master 7654/8449] kernel/dma/map_benchmark.c:195:37: warning: variable 'argp' is uninitialized when used within its own initialization kernel test robot
@ 2020-11-26 1:45 ` Song Bao Hua (Barry Song)
0 siblings, 0 replies; 2+ messages in thread
From: Song Bao Hua (Barry Song) @ 2020-11-26 1:45 UTC (permalink / raw)
To: kernel test robot
Cc: kbuild-all, clang-built-linux, Linux Memory Management List,
Christoph Hellwig
> -----Original Message-----
> From: kernel test robot [mailto:lkp@intel.com]
> Sent: Thursday, November 26, 2020 2:42 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Cc: kbuild-all@lists.01.org; clang-built-linux@googlegroups.com; Linux
> Memory Management List <linux-mm@kvack.org>; Christoph Hellwig
> <hch@lst.de>
> Subject: [linux-next:master 7654/8449] kernel/dma/map_benchmark.c:195:37:
> warning: variable 'argp' is uninitialized when used within its own initialization
A fix is here:
https://lore.kernel.org/linux-iommu/20201125135535.1880307-1-colin.king@canonical.com/
>
Thanks
Barry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-26 1:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 1:42 [linux-next:master 7654/8449] kernel/dma/map_benchmark.c:195:37: warning: variable 'argp' is uninitialized when used within its own initialization kernel test robot
2020-11-26 1:45 ` Song Bao Hua (Barry Song)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox