[ceph-client:testing 2/5] net/ceph/osdmap.c:203:6: warning: no previous prototype for 'clear_crush_names'
by kbuild test robot
tree: https://github.com/ceph/ceph-client.git testing
head: b3a5867e0780ac0279cf1541ed985db78f186221
commit: a9112bbf346099ab532fc52ef87d46935fe8e519 [2/5] libceph: decode CRUSH device/bucket types and names
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
git checkout a9112bbf346099ab532fc52ef87d46935fe8e519
# 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: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:13,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:9,
from include/linux/highmem.h:10,
from include/linux/pagemap.h:11,
from include/linux/blkdev.h:16,
from include/linux/backing-dev.h:15,
from include/linux/ceph/libceph.h:8,
from net/ceph/osdmap.c:8:
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
83 | ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); | ^~~
arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
430 | rom_out_8(port, *buf++);
| ^~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
86 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); | ^~~
arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
448 | rom_out_be16(port, *buf++);
| ^~~~~~~~~~~~
arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
90 | ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); | ^~~
arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
466 | rom_out_le16(port, *buf++);
| ^~~~~~~~~~~~
In file included from include/linux/string.h:6,
from include/linux/ceph/ceph_debug.h:7,
from net/ceph/osdmap.c:3:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #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:143:2: note: in expansion of macro 'BUG_ON'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from net/ceph/osdmap.c:5:
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:139:27: note: in definition of macro 'WARN_ON_ONCE'
139 | int __ret_warn_once = !!(condition); | ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro 'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~
net/ceph/osdmap.c: At top level:
>> net/ceph/osdmap.c:203:6: warning: no previous prototype for 'clear_crush_names' [-Wmissing-prototypes]
203 | void clear_crush_names(struct rb_root *root)
| ^~~~~~~~~~~~~~~~~
net/ceph/osdmap.c:249:6: warning: no previous prototype for 'clear_choose_args' [-Wmissing-prototypes]
249 | void clear_choose_args(struct crush_map *c)
| ^~~~~~~~~~~~~~~~~
In file included from net/ceph/osdmap.c:8:
include/linux/ceph/libceph.h:234:14: warning: 'lookup_crush_name' defined but not used [-Wunused-function]
234 | static type *lookup_##name(struct rb_root *root, lookup_param_type key) | ^~~~~~~
include/linux/ceph/libceph.h:268:1: note: in expansion of macro 'DEFINE_RB_LOOKUP_FUNC2'
268 | DEFINE_RB_LOOKUP_FUNC2(name, type, keyfld, RB_CMP3WAY, RB_BYVAL, | ^~~~~~~~~~~~~~~~~~~~~~
include/linux/ceph/libceph.h:273:1: note: in expansion of macro 'DEFINE_RB_LOOKUP_FUNC'
273 | DEFINE_RB_LOOKUP_FUNC(name, type, keyfld, nodefld)
| ^~~~~~~~~~~~~~~~~~~~~
net/ceph/osdmap.c:166:1: note: in expansion of macro 'DEFINE_RB_FUNCS'
166 | DEFINE_RB_FUNCS(crush_name, struct crush_name_node, cn_id, cn_node)
| ^~~~~~~~~~~~~~~
vim +/clear_crush_names +203 net/ceph/osdmap.c
202
> 203 void clear_crush_names(struct rb_root *root)
204 {
205 while (!RB_EMPTY_ROOT(root)) {
206 struct crush_name_node *cn =
207 rb_entry(rb_first(root), struct crush_name_node, cn_node);
208
209 erase_crush_name(root, cn);
210 free_crush_name(cn);
211 }
212 }
213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
Re: [PATCH 1/4] scsi: convert target lookup to xarray
by Dan Carpenter
Hi Hannes,
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.7-rc7 next-20200529]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/scsi-use-xarray-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-m001-20200529 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/scsi/scsi_scan.c:482 scsi_alloc_target() warn: inconsistent returns '*shost->host_lock'.
drivers/scsi/scsi_scan.c:482 scsi_alloc_target() warn: inconsistent returns 'flags'.
# https://github.com/0day-ci/linux/commit/45b149b239ea9a86968ddbd8ecda1e6c4...
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 45b149b239ea9a86968ddbd8ecda1e6c44937b68
vim +482 drivers/scsi/scsi_scan.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 392 static struct scsi_target *scsi_alloc_target(struct device *parent,
^1da177e4c3f41 Linus Torvalds 2005-04-16 393 int channel, uint id)
^1da177e4c3f41 Linus Torvalds 2005-04-16 394 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 395 struct Scsi_Host *shost = dev_to_shost(parent);
^1da177e4c3f41 Linus Torvalds 2005-04-16 396 struct device *dev = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 397 unsigned long flags;
^1da177e4c3f41 Linus Torvalds 2005-04-16 398 const int size = sizeof(struct scsi_target)
^1da177e4c3f41 Linus Torvalds 2005-04-16 399 + shost->transportt->target_size;
5c44cd2afad3f7 James.Smart(a)Emulex.Com 2005-06-10 400 struct scsi_target *starget;
^1da177e4c3f41 Linus Torvalds 2005-04-16 401 struct scsi_target *found_target;
e63ed0d7a98014 James Bottomley 2014-01-21 402 int error, ref_got;
45b149b239ea9a Hannes Reinecke 2020-05-27 403 unsigned long tid;
^1da177e4c3f41 Linus Torvalds 2005-04-16 404
24669f75a3231f Jes Sorensen 2006-01-16 405 starget = kzalloc(size, GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 406 if (!starget) {
cadbd4a5e36dde Harvey Harrison 2008-07-03 407 printk(KERN_ERR "%s: allocation failure\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 408 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 409 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 410 dev = &starget->dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 411 device_initialize(dev);
e63ed0d7a98014 James Bottomley 2014-01-21 412 kref_init(&starget->reap_ref);
^1da177e4c3f41 Linus Torvalds 2005-04-16 413 dev->parent = get_device(parent);
71610f55fa4db6 Kay Sievers 2008-12-03 414 dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id);
b0ed43360fdca2 Hannes Reinecke 2008-03-18 415 dev->bus = &scsi_bus_type;
b0ed43360fdca2 Hannes Reinecke 2008-03-18 416 dev->type = &scsi_target_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 417 starget->id = id;
^1da177e4c3f41 Linus Torvalds 2005-04-16 418 starget->channel = channel;
f0c0a376d0fcd4 Mike Christie 2008-08-17 419 starget->can_queue = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 420 INIT_LIST_HEAD(&starget->devices);
643eb2d932c97a James Bottomley 2008-03-22 421 starget->state = STARGET_CREATED;
7c9d6f16f50d3a Alan Stern 2007-01-08 422 starget->scsi_level = SCSI_2;
c53a284f8be237 Edward Goggin 2009-04-09 423 starget->max_target_blocked = SCSI_DEFAULT_TARGET_BLOCKED;
45b149b239ea9a Hannes Reinecke 2020-05-27 424 tid = scsi_target_index(starget);
ffedb4522571ac James Bottomley 2006-02-23 425 retry:
^1da177e4c3f41 Linus Torvalds 2005-04-16 426 spin_lock_irqsave(shost->host_lock, flags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^1da177e4c3f41 Linus Torvalds 2005-04-16 427
45b149b239ea9a Hannes Reinecke 2020-05-27 428 found_target = xa_load(&shost->__targets, tid);
^1da177e4c3f41 Linus Torvalds 2005-04-16 429 if (found_target)
^1da177e4c3f41 Linus Torvalds 2005-04-16 430 goto found;
45b149b239ea9a Hannes Reinecke 2020-05-27 431 if (xa_insert(&shost->__targets, tid, starget, GFP_KERNEL)) {
45b149b239ea9a Hannes Reinecke 2020-05-27 432 dev_printk(KERN_ERR, dev, "target index busy\n");
45b149b239ea9a Hannes Reinecke 2020-05-27 433 kfree(starget);
45b149b239ea9a Hannes Reinecke 2020-05-27 434 return NULL;
^^^^^^^^^^^
Need to drop the lock.
45b149b239ea9a Hannes Reinecke 2020-05-27 435 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 436 spin_unlock_irqrestore(shost->host_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 437 /* allocate and add */
a283bd37d00e92 James Bottomley 2005-05-24 438 transport_setup_device(dev);
a283bd37d00e92 James Bottomley 2005-05-24 439 if (shost->hostt->target_alloc) {
32f95792500794 Brian King 2006-02-22 440 error = shost->hostt->target_alloc(starget);
a283bd37d00e92 James Bottomley 2005-05-24 441
a283bd37d00e92 James Bottomley 2005-05-24 442 if(error) {
a283bd37d00e92 James Bottomley 2005-05-24 443 dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
a283bd37d00e92 James Bottomley 2005-05-24 444 /* don't want scsi_target_reap to do the final
a283bd37d00e92 James Bottomley 2005-05-24 445 * put because it will be under the host lock */
643eb2d932c97a James Bottomley 2008-03-22 446 scsi_target_destroy(starget);
a283bd37d00e92 James Bottomley 2005-05-24 447 return NULL;
a283bd37d00e92 James Bottomley 2005-05-24 448 }
a283bd37d00e92 James Bottomley 2005-05-24 449 }
884d25cc4fda20 James Bottomley 2006-09-05 450 get_device(dev);
a283bd37d00e92 James Bottomley 2005-05-24 451
^1da177e4c3f41 Linus Torvalds 2005-04-16 452 return starget;
^1da177e4c3f41 Linus Torvalds 2005-04-16 453
^1da177e4c3f41 Linus Torvalds 2005-04-16 454 found:
e63ed0d7a98014 James Bottomley 2014-01-21 455 /*
e63ed0d7a98014 James Bottomley 2014-01-21 456 * release routine already fired if kref is zero, so if we can still
e63ed0d7a98014 James Bottomley 2014-01-21 457 * take the reference, the target must be alive. If we can't, it must
e63ed0d7a98014 James Bottomley 2014-01-21 458 * be dying and we need to wait for a new target
e63ed0d7a98014 James Bottomley 2014-01-21 459 */
e63ed0d7a98014 James Bottomley 2014-01-21 460 ref_got = kref_get_unless_zero(&found_target->reap_ref);
e63ed0d7a98014 James Bottomley 2014-01-21 461
^1da177e4c3f41 Linus Torvalds 2005-04-16 462 spin_unlock_irqrestore(shost->host_lock, flags);
e63ed0d7a98014 James Bottomley 2014-01-21 463 if (ref_got) {
12fb8c1574d7d0 Alan Stern 2010-03-18 464 put_device(dev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 465 return found_target;
^1da177e4c3f41 Linus Torvalds 2005-04-16 466 }
e63ed0d7a98014 James Bottomley 2014-01-21 467 /*
e63ed0d7a98014 James Bottomley 2014-01-21 468 * Unfortunately, we found a dying target; need to wait until it's
e63ed0d7a98014 James Bottomley 2014-01-21 469 * dead before we can get a new one. There is an anomaly here. We
e63ed0d7a98014 James Bottomley 2014-01-21 470 * *should* call scsi_target_reap() to balance the kref_get() of the
e63ed0d7a98014 James Bottomley 2014-01-21 471 * reap_ref above. However, since the target being released, it's
e63ed0d7a98014 James Bottomley 2014-01-21 472 * already invisible and the reap_ref is irrelevant. If we call
e63ed0d7a98014 James Bottomley 2014-01-21 473 * scsi_target_reap() we might spuriously do another device_del() on
e63ed0d7a98014 James Bottomley 2014-01-21 474 * an already invisible target.
e63ed0d7a98014 James Bottomley 2014-01-21 475 */
ffedb4522571ac James Bottomley 2006-02-23 476 put_device(&found_target->dev);
e63ed0d7a98014 James Bottomley 2014-01-21 477 /*
e63ed0d7a98014 James Bottomley 2014-01-21 478 * length of time is irrelevant here, we just want to yield the CPU
e63ed0d7a98014 James Bottomley 2014-01-21 479 * for a tick to avoid busy waiting for the target to die.
e63ed0d7a98014 James Bottomley 2014-01-21 480 */
e63ed0d7a98014 James Bottomley 2014-01-21 481 msleep(1);
ffedb4522571ac James Bottomley 2006-02-23 @482 goto retry;
ffedb4522571ac James Bottomley 2006-02-23 483 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
Re: [PATCH 5/5] scsi_error: use xarray lookup instead of wrappers
by kbuild test robot
Hi Hannes,
I love your patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.7-rc7 next-20200529]
[cannot apply to hch-configfs/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/scsi-use-xarray-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2388a096e7865c043e83ece4e26654bd3d1a20d5)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/scsi/scsi_error.c:686:15: warning: variable 'starget' is uninitialized when used here [-Wuninitialized]
xa_for_each(&starget->__devices, lun_idx, tmp_sdev) {
^~~~~~~
include/linux/xarray.h:497:20: note: expanded from macro 'xa_for_each'
xa_for_each_start(xa, index, entry, 0)
^~
include/linux/xarray.h:473:20: note: expanded from macro 'xa_for_each_start'
xa_for_each_range(xa, index, entry, start, ULONG_MAX)
^~
include/linux/xarray.h:445:23: note: expanded from macro 'xa_for_each_range'
entry = xa_find(xa, &index, last, XA_PRESENT); ^~
drivers/scsi/scsi_error.c:679:29: note: initialize the variable 'starget' to silence this warning
struct scsi_target *starget;
^
= NULL
1 warning generated.
vim +/starget +686 drivers/scsi/scsi_error.c
675
676 static void scsi_handle_queue_full(struct scsi_device *sdev)
677 {
678 struct scsi_host_template *sht = sdev->host->hostt;
679 struct scsi_target *starget;
680 struct scsi_device *tmp_sdev;
681 unsigned long lun_idx = 0;
682
683 if (!sht->track_queue_depth)
684 return;
685
> 686 xa_for_each(&starget->__devices, lun_idx, tmp_sdev) {
687 if (tmp_sdev->sdev_state == SDEV_DEL)
688 continue;
689 /*
690 * We do not know the number of commands that were at
691 * the device when we got the queue full so we start
692 * from the highest possible value and work our way down.
693 */
694 scsi_track_queue_full(tmp_sdev, tmp_sdev->queue_depth - 1);
695 }
696 }
697
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
[ceph-client:wip-read-from-replica-balance 2/6] net/ceph/osdmap.c:203:6: warning: no previous prototype for function 'clear_crush_names'
by kbuild test robot
tree: https://github.com/ceph/ceph-client.git wip-read-from-replica-balance
head: bd7eed083094ca9eff9143837f019c7579b1046a
commit: a9112bbf346099ab532fc52ef87d46935fe8e519 [2/6] libceph: decode CRUSH device/bucket types and names
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2388a096e7865c043e83ece4e26654bd3d1a20d5)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout a9112bbf346099ab532fc52ef87d46935fe8e519
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> net/ceph/osdmap.c:203:6: warning: no previous prototype for function 'clear_crush_names' [-Wmissing-prototypes]
void clear_crush_names(struct rb_root *root)
^
net/ceph/osdmap.c:203:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void clear_crush_names(struct rb_root *root)
^
static
net/ceph/osdmap.c:249:6: warning: no previous prototype for function 'clear_choose_args' [-Wmissing-prototypes]
void clear_choose_args(struct crush_map *c)
^
net/ceph/osdmap.c:249:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void clear_choose_args(struct crush_map *c)
^
static
net/ceph/osdmap.c:1289:10: warning: result of comparison of constant 4611686018427387891 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32))
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ceph/osdmap.c:1472:10: warning: result of comparison of constant 2305843009213693945 with expression of type 'u32' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
if (len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32)))
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ceph/osdmap.c:166:1: warning: unused function 'lookup_crush_name' [-Wunused-function]
DEFINE_RB_FUNCS(crush_name, struct crush_name_node, cn_id, cn_node)
^
include/linux/ceph/libceph.h:272:55: note: expanded from macro 'DEFINE_RB_FUNCS'
DEFINE_RB_INSDEL_FUNCS(name, type, keyfld, nodefld) ^
include/linux/ceph/libceph.h:267:40: note: expanded from macro ' DEFINE_RB_LOOKUP_FUNC'
extern type __lookup_##name##_key; ^
include/linux/ceph/libceph.h:234:14: note: expanded from macro ' DEFINE_RB_LOOKUP_FUNC2'
static type *lookup_##name(struct rb_root *root, lookup_param_type key) ^
<scratch space>:47:1: note: expanded from here
lookup_crush_name
^
5 warnings generated.
vim +/clear_crush_names +203 net/ceph/osdmap.c
202
> 203 void clear_crush_names(struct rb_root *root)
204 {
205 while (!RB_EMPTY_ROOT(root)) {
206 struct crush_name_node *cn =
207 rb_entry(rb_first(root), struct crush_name_node, cn_node);
208
209 erase_crush_name(root, cn);
210 free_crush_name(cn);
211 }
212 }
213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
Re: [PATCH Kernel v24 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking
by kbuild test robot
Hi Kirti,
I love your patch! Perhaps something to improve:
[auto build test WARNING on v5.7-rc7]
[also build test WARNING on next-20200529]
[cannot apply to vfio/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kirti-Wankhede/Add-UAPIs-to-supp...
base: 9cb1fd0efd195590b828b9b865421ad345a4a145
config: i386-randconfig-s031-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/vfio/vfio_iommu_type1.c:952:37: sparse: sparse: cast removes address space '<asn:1>' of expression
>> drivers/vfio/vfio_iommu_type1.c:952:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got void const * @@
drivers/vfio/vfio_iommu_type1.c:952:37: sparse: expected void const [noderef] <asn:1> *from
>> drivers/vfio/vfio_iommu_type1.c:952:37: sparse: got void const *
drivers/vfio/vfio_iommu_type1.c:959:27: sparse: sparse: cast removes address space '<asn:1>' of expression
>> drivers/vfio/vfio_iommu_type1.c:959:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:1> *to @@ got void * @@
drivers/vfio/vfio_iommu_type1.c:959:27: sparse: expected void [noderef] <asn:1> *to
>> drivers/vfio/vfio_iommu_type1.c:959:27: sparse: got void *
vim +952 drivers/vfio/vfio_iommu_type1.c
932
933 static int update_user_bitmap(u64 __user *bitmap, struct vfio_dma *dma,
934 dma_addr_t base_iova, size_t pgsize)
935 {
936 unsigned long pgshift = __ffs(pgsize);
937 unsigned long nbits = dma->size >> pgshift;
938 unsigned long bit_offset = (dma->iova - base_iova) >> pgshift;
939 unsigned long copy_offset = bit_offset / BITS_PER_LONG;
940 unsigned long shift = bit_offset % BITS_PER_LONG;
941 unsigned long leftover;
942
943 /* mark all pages dirty if all pages are pinned and mapped. */
944 if (dma->iommu_mapped)
945 bitmap_set(dma->bitmap, 0, nbits);
946
947 if (shift) {
948 bitmap_shift_left(dma->bitmap, dma->bitmap, shift,
949 nbits + shift);
950
951 if (copy_from_user(&leftover,
> 952 (const void *)(bitmap + copy_offset),
953 sizeof(leftover)))
954 return -EFAULT;
955
956 bitmap_or(dma->bitmap, dma->bitmap, &leftover, shift);
957 }
958
> 959 if (copy_to_user((void *)(bitmap + copy_offset), dma->bitmap,
960 DIRTY_BITMAP_BYTES(nbits + shift)))
961 return -EFAULT;
962
963 return 0;
964 }
965
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
[linux-next:master 569/14131] drivers/gpu/drm/drm_managed.c:49:6: warning: no previous prototype for function 'drm_managed_release'
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: e7b08814b16b80a0bf76eeca16317f8c2ed23b8c
commit: c6603c740e0e3492c9c95fdab833375bf7117b6b [569/14131] drm: add managed resources tied to drm_device
config: x86_64-randconfig-a015-20200529 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2d068e534f1671459e1b135852c1b3c10502e929)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout c6603c740e0e3492c9c95fdab833375bf7117b6b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/gpu/drm/drm_managed.c:49:6: warning: no previous prototype for function 'drm_managed_release' [-Wmissing-prototypes]
void drm_managed_release(struct drm_device *dev)
^
drivers/gpu/drm/drm_managed.c:49:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void drm_managed_release(struct drm_device *dev)
^
static
1 warning generated.
vim +/drm_managed_release +49 drivers/gpu/drm/drm_managed.c
48
> 49 void drm_managed_release(struct drm_device *dev)
50 {
51 struct drmres *dr, *tmp;
52
53 drm_dbg_drmres(dev, "drmres release begin\n");
54 list_for_each_entry_safe(dr, tmp, &dev->managed.resources, node.entry) {
55 drm_dbg_drmres(dev, "REL %p %s (%zu bytes)\n",
56 dr, dr->node.name, dr->node.size);
57
58 if (dr->node.release)
59 dr->node.release(dev, dr->node.size ? *(void **)&dr->data : NULL);
60
61 list_del(&dr->node.entry);
62 free_dr(dr);
63 }
64 drm_dbg_drmres(dev, "drmres release end\n");
65 }
66
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used. [redundantAssignment]
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ffeb595d84811dde16a28b33d8a7cf26d51d51b3
commit: b9d1e2e6265f5dc25e9f5dbfbde3e53d8a4958ac exfat: add Kconfig and Makefile
date: 3 months ago
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> fs/exfat/nls.c:531:22: warning: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used. [redundantAssignment]
p_uniname->name_len = unilen;
^
fs/exfat/nls.c:519:22: note: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used.
p_uniname->name_len = unilen & 0xFF;
^
fs/exfat/nls.c:531:22: note: Variable 'p_uniname->name_len' is reassigned a value before the old one has been used.
p_uniname->name_len = unilen;
^
vim +531 fs/exfat/nls.c
370e812b3ec190 Namjae Jeon 2020-03-02 492
370e812b3ec190 Namjae Jeon 2020-03-02 493 static int exfat_utf8_to_utf16(struct super_block *sb,
370e812b3ec190 Namjae Jeon 2020-03-02 494 const unsigned char *p_cstring, const int len,
370e812b3ec190 Namjae Jeon 2020-03-02 495 struct exfat_uni_name *p_uniname, int *p_lossy)
370e812b3ec190 Namjae Jeon 2020-03-02 496 {
370e812b3ec190 Namjae Jeon 2020-03-02 497 int i, unilen, lossy = NLS_NAME_NO_LOSSY;
370e812b3ec190 Namjae Jeon 2020-03-02 498 unsigned short upname[MAX_NAME_LENGTH + 1];
370e812b3ec190 Namjae Jeon 2020-03-02 499 unsigned short *uniname = p_uniname->name;
370e812b3ec190 Namjae Jeon 2020-03-02 500
370e812b3ec190 Namjae Jeon 2020-03-02 501 WARN_ON(!len);
370e812b3ec190 Namjae Jeon 2020-03-02 502
370e812b3ec190 Namjae Jeon 2020-03-02 503 unilen = utf8s_to_utf16s(p_cstring, len, UTF16_HOST_ENDIAN,
370e812b3ec190 Namjae Jeon 2020-03-02 504 (wchar_t *)uniname, MAX_NAME_LENGTH + 2);
370e812b3ec190 Namjae Jeon 2020-03-02 505 if (unilen < 0) {
370e812b3ec190 Namjae Jeon 2020-03-02 506 exfat_msg(sb, KERN_ERR,
370e812b3ec190 Namjae Jeon 2020-03-02 507 "failed to %s (err : %d) nls len : %d",
370e812b3ec190 Namjae Jeon 2020-03-02 508 __func__, unilen, len);
370e812b3ec190 Namjae Jeon 2020-03-02 509 return unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 510 }
370e812b3ec190 Namjae Jeon 2020-03-02 511
370e812b3ec190 Namjae Jeon 2020-03-02 512 if (unilen > MAX_NAME_LENGTH) {
370e812b3ec190 Namjae Jeon 2020-03-02 513 exfat_msg(sb, KERN_ERR,
370e812b3ec190 Namjae Jeon 2020-03-02 514 "failed to %s (estr:ENAMETOOLONG) nls len : %d, unilen : %d > %d",
370e812b3ec190 Namjae Jeon 2020-03-02 515 __func__, len, unilen, MAX_NAME_LENGTH);
370e812b3ec190 Namjae Jeon 2020-03-02 516 return -ENAMETOOLONG;
370e812b3ec190 Namjae Jeon 2020-03-02 517 }
370e812b3ec190 Namjae Jeon 2020-03-02 518
370e812b3ec190 Namjae Jeon 2020-03-02 519 p_uniname->name_len = unilen & 0xFF;
370e812b3ec190 Namjae Jeon 2020-03-02 520
370e812b3ec190 Namjae Jeon 2020-03-02 521 for (i = 0; i < unilen; i++) {
370e812b3ec190 Namjae Jeon 2020-03-02 522 if (*uniname < 0x0020 ||
370e812b3ec190 Namjae Jeon 2020-03-02 523 exfat_wstrchr(bad_uni_chars, *uniname))
370e812b3ec190 Namjae Jeon 2020-03-02 524 lossy |= NLS_NAME_LOSSY;
370e812b3ec190 Namjae Jeon 2020-03-02 525
370e812b3ec190 Namjae Jeon 2020-03-02 526 upname[i] = exfat_toupper(sb, *uniname);
370e812b3ec190 Namjae Jeon 2020-03-02 527 uniname++;
370e812b3ec190 Namjae Jeon 2020-03-02 528 }
370e812b3ec190 Namjae Jeon 2020-03-02 529
370e812b3ec190 Namjae Jeon 2020-03-02 530 *uniname = '\0';
370e812b3ec190 Namjae Jeon 2020-03-02 @531 p_uniname->name_len = unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 532 p_uniname->name_hash = exfat_calc_chksum_2byte(upname, unilen << 1, 0,
370e812b3ec190 Namjae Jeon 2020-03-02 533 CS_DEFAULT);
370e812b3ec190 Namjae Jeon 2020-03-02 534
370e812b3ec190 Namjae Jeon 2020-03-02 535 if (p_lossy)
370e812b3ec190 Namjae Jeon 2020-03-02 536 *p_lossy = lossy;
370e812b3ec190 Namjae Jeon 2020-03-02 537 return unilen;
370e812b3ec190 Namjae Jeon 2020-03-02 538 }
370e812b3ec190 Namjae Jeon 2020-03-02 539
:::::: The code at line 531 was first introduced by commit
:::::: 370e812b3ec190fa492c9fd5a80c38b086d105c0 exfat: add nls operations
:::::: TO: Namjae Jeon <namjae.jeon(a)samsung.com>
:::::: CC: Al Viro <viro(a)zeniv.linux.org.uk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
[linux-next:master 788/14131] net/bluetooth/l2cap_sock.c:676:21: sparse: sparse: incorrect type in initializer (different address spaces)
by kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: e7b08814b16b80a0bf76eeca16317f8c2ed23b8c
commit: 3ee7b7cd83900bb711efadbf16fa096a615a1566 [788/14131] Bluetooth: Add BT_MODE socket option
config: openrisc-randconfig-s032-20200531 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
git checkout 3ee7b7cd83900bb711efadbf16fa096a615a1566
# save the attached .config to linux build tree
make W=1 C=1 ARCH=openrisc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
net/bluetooth/l2cap_sock.c:428:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] <asn:1> *optlen @@
net/bluetooth/l2cap_sock.c:428:13: sparse: expected int const *__gu_addr
net/bluetooth/l2cap_sock.c:428:13: sparse: got int [noderef] <asn:1> *optlen
net/bluetooth/l2cap_sock.c:503:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:503:21: sparse: expected unsigned int *__pu_addr
net/bluetooth/l2cap_sock.c:503:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:553:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderef] <asn:1> *optlen @@
net/bluetooth/l2cap_sock.c:553:13: sparse: expected int const *__gu_addr
net/bluetooth/l2cap_sock.c:553:13: sparse: got int [noderef] <asn:1> *optlen
net/bluetooth/l2cap_sock.c:589:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:589:21: sparse: expected unsigned int *__pu_addr
net/bluetooth/l2cap_sock.c:589:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:596:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:596:21: sparse: expected unsigned int *__pu_addr
net/bluetooth/l2cap_sock.c:596:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:618:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:618:21: sparse: expected unsigned int *__pu_addr
net/bluetooth/l2cap_sock.c:618:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:633:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short *__pu_addr @@ got unsigned short [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:633:21: sparse: expected unsigned short *__pu_addr
net/bluetooth/l2cap_sock.c:633:21: sparse: got unsigned short [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:643:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short *__pu_addr @@ got unsigned short [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:643:21: sparse: expected unsigned short *__pu_addr
net/bluetooth/l2cap_sock.c:643:21: sparse: got unsigned short [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:655:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:655:21: sparse: expected unsigned int *__pu_addr
net/bluetooth/l2cap_sock.c:655:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
>> net/bluetooth/l2cap_sock.c:676:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char *__pu_addr @@ got unsigned char [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:676:21: sparse: expected unsigned char *__pu_addr
net/bluetooth/l2cap_sock.c:676:21: sparse: got unsigned char [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:785:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:785:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:785:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:942:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:942:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:942:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:957:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:957:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:957:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:1005:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1005:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:1005:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:1053:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1053:21: sparse: expected unsigned short const *__gu_addr
net/bluetooth/l2cap_sock.c:1053:21: sparse: got unsigned short [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:1084:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] [usertype] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1084:21: sparse: expected unsigned char const *__gu_addr
net/bluetooth/l2cap_sock.c:1084:21: sparse: got unsigned char [noderef] [usertype] <asn:1> *
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] <asn:1> *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] <asn:1> *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] <asn:1> *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] <asn:1> *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] <asn:1> *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] <asn:1> *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] <asn:1> *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] <asn:1> *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] <asn:1> *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] <asn:1> *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] <asn:1> *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] <asn:1> *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] <asn:1> *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] <asn:1> *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] <asn:1> *from
arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int
arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int
arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int
vim +676 net/bluetooth/l2cap_sock.c
534
535 static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
536 char __user *optval, int __user *optlen)
537 {
538 struct sock *sk = sock->sk;
539 struct l2cap_chan *chan = l2cap_pi(sk)->chan;
540 struct bt_security sec;
541 struct bt_power pwr;
542 u32 phys;
543 int len, mode, err = 0;
544
545 BT_DBG("sk %p", sk);
546
547 if (level == SOL_L2CAP)
548 return l2cap_sock_getsockopt_old(sock, optname, optval, optlen);
549
550 if (level != SOL_BLUETOOTH)
551 return -ENOPROTOOPT;
552
553 if (get_user(len, optlen))
554 return -EFAULT;
555
556 lock_sock(sk);
557
558 switch (optname) {
559 case BT_SECURITY:
560 if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
561 chan->chan_type != L2CAP_CHAN_FIXED &&
562 chan->chan_type != L2CAP_CHAN_RAW) {
563 err = -EINVAL;
564 break;
565 }
566
567 memset(&sec, 0, sizeof(sec));
568 if (chan->conn) {
569 sec.level = chan->conn->hcon->sec_level;
570
571 if (sk->sk_state == BT_CONNECTED)
572 sec.key_size = chan->conn->hcon->enc_key_size;
573 } else {
574 sec.level = chan->sec_level;
575 }
576
577 len = min_t(unsigned int, len, sizeof(sec));
578 if (copy_to_user(optval, (char *) &sec, len))
579 err = -EFAULT;
580
581 break;
582
583 case BT_DEFER_SETUP:
584 if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
585 err = -EINVAL;
586 break;
587 }
588
589 if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags),
590 (u32 __user *) optval))
591 err = -EFAULT;
592
593 break;
594
595 case BT_FLUSHABLE:
596 if (put_user(test_bit(FLAG_FLUSHABLE, &chan->flags),
597 (u32 __user *) optval))
598 err = -EFAULT;
599
600 break;
601
602 case BT_POWER:
603 if (sk->sk_type != SOCK_SEQPACKET && sk->sk_type != SOCK_STREAM
604 && sk->sk_type != SOCK_RAW) {
605 err = -EINVAL;
606 break;
607 }
608
609 pwr.force_active = test_bit(FLAG_FORCE_ACTIVE, &chan->flags);
610
611 len = min_t(unsigned int, len, sizeof(pwr));
612 if (copy_to_user(optval, (char *) &pwr, len))
613 err = -EFAULT;
614
615 break;
616
617 case BT_CHANNEL_POLICY:
618 if (put_user(chan->chan_policy, (u32 __user *) optval))
619 err = -EFAULT;
620 break;
621
622 case BT_SNDMTU:
623 if (!bdaddr_type_is_le(chan->src_type)) {
624 err = -EINVAL;
625 break;
626 }
627
628 if (sk->sk_state != BT_CONNECTED) {
629 err = -ENOTCONN;
630 break;
631 }
632
> 633 if (put_user(chan->omtu, (u16 __user *) optval))
634 err = -EFAULT;
635 break;
636
637 case BT_RCVMTU:
638 if (!bdaddr_type_is_le(chan->src_type)) {
639 err = -EINVAL;
640 break;
641 }
642
643 if (put_user(chan->imtu, (u16 __user *) optval))
644 err = -EFAULT;
645 break;
646
647 case BT_PHY:
648 if (sk->sk_state != BT_CONNECTED) {
649 err = -ENOTCONN;
650 break;
651 }
652
653 phys = hci_conn_get_phy(chan->conn->hcon);
654
655 if (put_user(phys, (u32 __user *) optval))
656 err = -EFAULT;
657 break;
658
659 case BT_MODE:
660 if (!enable_ecred) {
661 err = -ENOPROTOOPT;
662 break;
663 }
664
665 if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
666 err = -EINVAL;
667 break;
668 }
669
670 mode = l2cap_get_mode(chan);
671 if (mode < 0) {
672 err = mode;
673 break;
674 }
675
> 676 if (put_user(mode, (u8 __user *) optval))
677 err = -EFAULT;
678 break;
679
680 default:
681 err = -ENOPROTOOPT;
682 break;
683 }
684
685 release_sock(sk);
686 return err;
687 }
688
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months
Re: [PATCH] scsi_scan: handle REPORT LUN overflow
by kbuild test robot
Hi Hannes,
I love your patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next hch-configfs/for-next v5.7-rc7 next-20200529]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Hannes-Reinecke/scsi_scan-handle...
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20200531 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/scsi_scan.c:1302:42: sparse: sparse: incorrect type in initializer (different base types) @@ expected int alloc_flags @@ got restricted gfp_t @@
>> drivers/scsi/scsi_scan.c:1302:42: sparse: expected int alloc_flags
>> drivers/scsi/scsi_scan.c:1302:42: sparse: got restricted gfp_t
>> drivers/scsi/scsi_scan.c:1339:36: sparse: sparse: restricted gfp_t degrades to integer
>> drivers/scsi/scsi_scan.c:1339:47: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted gfp_t [usertype] flags @@ got unsigned int @@
>> drivers/scsi/scsi_scan.c:1339:47: sparse: expected restricted gfp_t [usertype] flags
>> drivers/scsi/scsi_scan.c:1339:47: sparse: got unsigned int
drivers/scsi/scsi_scan.c:1411:50: sparse: sparse: restricted gfp_t degrades to integer
drivers/scsi/scsi_scan.c:1411:61: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted gfp_t [usertype] flags @@ got unsigned int @@
drivers/scsi/scsi_scan.c:1411:61: sparse: expected restricted gfp_t [usertype] flags
drivers/scsi/scsi_scan.c:1411:61: sparse: got unsigned int
vim +1302 drivers/scsi/scsi_scan.c
1267
1268 /**
1269 * scsi_report_lun_scan - Scan using SCSI REPORT LUN results
1270 * @starget: which target
1271 * @bflags: Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN
1272 * @rescan: nonzero if we can skip code only needed on first scan
1273 *
1274 * Description:
1275 * Fast scanning for modern (SCSI-3) devices by sending a REPORT LUN command.
1276 * Scan the resulting list of LUNs by calling scsi_probe_and_add_lun.
1277 *
1278 * If BLINK_REPORTLUN2 is set, scan a target that supports more than 8
1279 * LUNs even if it's older than SCSI-3.
1280 * If BLIST_NOREPORTLUN is set, return 1 always.
1281 * If BLIST_NOLUN is set, return 0 always.
1282 * If starget->no_report_luns is set, return 1 always.
1283 *
1284 * Return:
1285 * 0: scan completed (or no memory, so further scanning is futile)
1286 * 1: could not scan with REPORT LUN
1287 **/
1288 static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflags,
1289 enum scsi_scan_mode rescan)
1290 {
1291 unsigned char scsi_cmd[MAX_COMMAND_SIZE];
1292 unsigned int length;
1293 u64 lun;
1294 unsigned int num_luns;
1295 unsigned int retries;
1296 int result;
1297 struct scsi_lun *lunp, *lun_data;
1298 struct scsi_sense_hdr sshdr;
1299 struct scsi_device *sdev;
1300 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1301 int ret = 0, alloc_flags =
> 1302 shost->unchecked_isa_dma ? __GFP_DMA : 0;
1303
1304 /*
1305 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
1306 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
1307 * support more than 8 LUNs.
1308 * Don't attempt if the target doesn't support REPORT LUNS.
1309 */
1310 if (bflags & BLIST_NOREPORTLUN)
1311 return 1;
1312 if (starget->scsi_level < SCSI_2 &&
1313 starget->scsi_level != SCSI_UNKNOWN)
1314 return 1;
1315 if (starget->scsi_level < SCSI_3 &&
1316 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
1317 return 1;
1318 if (bflags & BLIST_NOLUN)
1319 return 0;
1320 if (starget->no_report_luns)
1321 return 1;
1322
1323 if (!(sdev = scsi_device_lookup_by_target(starget, 0))) {
1324 sdev = scsi_alloc_sdev(starget, 0, NULL);
1325 if (!sdev)
1326 return 0;
1327 if (scsi_device_get(sdev)) {
1328 __scsi_remove_device(sdev);
1329 return 0;
1330 }
1331 }
1332
1333 /*
1334 * Allocate enough to hold the header (the same size as one scsi_lun)
1335 * plus the number of luns we are requesting. 511 was the default
1336 * value of the now removed max_report_luns parameter.
1337 */
1338 length = (511 + 1) * sizeof(struct scsi_lun);
> 1339 lun_data = kmalloc(length, GFP_KERNEL | alloc_flags);
1340 if (!lun_data) {
1341 printk(ALLOC_FAILURE_MSG, __func__);
1342 goto out;
1343 }
1344
1345 retry:
1346 scsi_cmd[0] = REPORT_LUNS;
1347
1348 /*
1349 * bytes 1 - 5: reserved, set to zero.
1350 */
1351 memset(&scsi_cmd[1], 0, 5);
1352
1353 /*
1354 * bytes 6 - 9: length of the command.
1355 */
1356 put_unaligned_be32(length, &scsi_cmd[6]);
1357
1358 scsi_cmd[10] = 0; /* reserved */
1359 scsi_cmd[11] = 0; /* control */
1360
1361 /*
1362 * We can get a UNIT ATTENTION, for example a power on/reset, so
1363 * retry a few times (like sd.c does for TEST UNIT READY).
1364 * Experience shows some combinations of adapter/devices get at
1365 * least two power on/resets.
1366 *
1367 * Illegal requests (for devices that do not support REPORT LUNS)
1368 * should come through as a check condition, and will not generate
1369 * a retry.
1370 */
1371 for (retries = 0; retries < 3; retries++) {
1372 SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
1373 "scsi scan: Sending REPORT LUNS to (try %d)\n",
1374 retries));
1375
1376 result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE,
1377 lun_data, length, &sshdr,
1378 SCSI_REPORT_LUNS_TIMEOUT, 3, NULL);
1379
1380 SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
1381 "scsi scan: REPORT LUNS"
1382 " %s (try %d) result 0x%x\n",
1383 result ? "failed" : "successful",
1384 retries, result));
1385 if (result == 0)
1386 break;
1387 else if (scsi_sense_valid(&sshdr)) {
1388 if (sshdr.sense_key != UNIT_ATTENTION)
1389 break;
1390 }
1391 }
1392
1393 if (result) {
1394 /*
1395 * The device probably does not support a REPORT LUN command
1396 */
1397 ret = 1;
1398 goto out_err;
1399 }
1400
1401 /*
1402 * Get the length from the first four bytes of lun_data.
1403 */
1404 if (get_unaligned_be32(lun_data->scsi_lun) +
1405 sizeof(struct scsi_lun) > length) {
1406 unsigned int resp_length;
1407 void *resp_data;
1408
1409 resp_length = get_unaligned_be32(lun_data->scsi_lun) +
1410 sizeof(struct scsi_lun);
1411 resp_data = kmalloc(resp_length, GFP_KERNEL | alloc_flags);
1412 if (resp_data) {
1413 kfree(lun_data);
1414 lun_data = resp_data;
1415 length = resp_length;
1416 goto retry;
1417 }
1418 printk(ALLOC_FAILURE_MSG, __func__);
1419 } else
1420 length = get_unaligned_be32(lun_data->scsi_lun);
1421
1422 num_luns = (length / sizeof(struct scsi_lun));
1423
1424 SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
1425 "scsi scan: REPORT LUN scan\n"));
1426
1427 /*
1428 * Scan the luns in lun_data. The entry at offset 0 is really
1429 * the header, so start at 1 and go up to and including num_luns.
1430 */
1431 for (lunp = &lun_data[1]; lunp <= &lun_data[num_luns]; lunp++) {
1432 lun = scsilun_to_int(lunp);
1433
1434 if (lun > sdev->host->max_lun) {
1435 sdev_printk(KERN_WARNING, sdev,
1436 "lun%llu has a LUN larger than"
1437 " allowed by the host adapter\n", lun);
1438 } else {
1439 int res;
1440
1441 res = scsi_probe_and_add_lun(starget,
1442 lun, NULL, NULL, rescan, NULL);
1443 if (res == SCSI_SCAN_NO_RESPONSE) {
1444 /*
1445 * Got some results, but now none, abort.
1446 */
1447 sdev_printk(KERN_ERR, sdev,
1448 "Unexpected response"
1449 " from lun %llu while scanning, scan"
1450 " aborted\n", (unsigned long long)lun);
1451 break;
1452 }
1453 }
1454 }
1455
1456 out_err:
1457 kfree(lun_data);
1458 out:
1459 if (scsi_device_created(sdev))
1460 /*
1461 * the sdev we used didn't appear in the report luns scan
1462 */
1463 __scsi_remove_device(sdev);
1464 scsi_device_put(sdev);
1465 return ret;
1466 }
1467
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 2 months