::::::
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check warning:
drivers/target/target_core_device.c:846:47: warning: shift by negative count
('-10') [-Wanalyzer-shift-count-negative]"
::::::
CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: Christoph Hellwig <[email protected]>
CC: Jens Axboe <[email protected]>
CC: "Martin K. Petersen" <[email protected]>
CC: Chaitanya Kulkarni <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master
head: 0678afa6055d14799c1dc1eee47c8025eba56cab
commit: 817e8b51eb3d927ce6d56ecf9f48bc3c5b26168b target: pass a block_device to
target_configure_unmap_from_queue
date: 8 weeks ago
:::::: branch date: 3 hours ago
:::::: commit date: 8 weeks ago
config: arm-randconfig-c002-20220611
(https://download.01.org/0day-ci/archive/20220612/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=817e8b51eb3d927ce6d56ecf9f48bc3c5b26168b
git remote add linus
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 817e8b51eb3d927ce6d56ecf9f48bc3c5b26168b
# save the config file
ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error'
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
gcc-analyzer warnings: (new ones prefixed by >>)
drivers/target/target_core_device.c: In function
'target_configure_unmap_from_queue':
>> drivers/target/target_core_device.c:846:47: warning: shift by negative count
>> ('-10') [-Wanalyzer-shift-count-negative]
846 | q->limits.max_discard_sectors >> (ilog2(block_size)
- 9);
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
'target_configure_unmap_from_queue': events 1-3
|
| 842 | if (!blk_queue_discard(q))
| | ^
| | |
| | (1) following 'false' branch...
|......
| 846 | q->limits.max_discard_sectors >>
(ilog2(block_size) - 9);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
| | |
|
| | (2) ...to here
(3) following 'false' branch...
|
'target_configure_unmap_from_queue': events 4-5
|
|include/asm-generic/bitops/builtin-fls.h:14:53:
| 14 | return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
| | |
| | (4) ...to
here
| | (5)
following 'false' branch...
|
'target_configure_unmap_from_queue': events 6-7
|
|drivers/target/target_core_device.c:846:69:
| 846 | q->limits.max_discard_sectors >>
(ilog2(block_size) - 9);
| |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
| | |
|
| | |
(6) ...to here
| | (7) shift by
negative amount here ('-10')
|
vim +846 drivers/target/target_core_device.c
0fd97ccf45be26 Christoph Hellwig 2012-10-08 830
8a9ebe717a133b Mike Christie 2016-01-18 831 /*
8a9ebe717a133b Mike Christie 2016-01-18 832 * Check if the underlying
struct block_device request_queue supports
8a9ebe717a133b Mike Christie 2016-01-18 833 * the QUEUE_FLAG_DISCARD bit
for UNMAP/WRITE_SAME in SCSI + TRIM
8a9ebe717a133b Mike Christie 2016-01-18 834 * in ATA and we need to set
TPE=1
8a9ebe717a133b Mike Christie 2016-01-18 835 */
8a9ebe717a133b Mike Christie 2016-01-18 836 bool
target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
817e8b51eb3d92 Christoph Hellwig 2022-04-15 837
struct block_device *bdev)
8a9ebe717a133b Mike Christie 2016-01-18 838 {
817e8b51eb3d92 Christoph Hellwig 2022-04-15 839 struct request_queue *q
= bdev_get_queue(bdev);
817e8b51eb3d92 Christoph Hellwig 2022-04-15 840 int block_size =
bdev_logical_block_size(bdev);
ea263c7fada4af Mike Christie 2016-06-02 841
8a9ebe717a133b Mike Christie 2016-01-18 842 if
(!blk_queue_discard(q))
8a9ebe717a133b Mike Christie 2016-01-18 843 return false;
8a9ebe717a133b Mike Christie 2016-01-18 844
ea263c7fada4af Mike Christie 2016-06-02 845
attrib->max_unmap_lba_count =
ea263c7fada4af Mike Christie 2016-06-02 @846
q->limits.max_discard_sectors >> (ilog2(block_size) - 9);
8a9ebe717a133b Mike Christie 2016-01-18 847 /*
8a9ebe717a133b Mike Christie 2016-01-18 848 * Currently hardcoded
to 1 in Linux/SCSI code..
8a9ebe717a133b Mike Christie 2016-01-18 849 */
8a9ebe717a133b Mike Christie 2016-01-18 850
attrib->max_unmap_block_desc_count = 1;
8a9ebe717a133b Mike Christie 2016-01-18 851
attrib->unmap_granularity = q->limits.discard_granularity / block_size;
8a9ebe717a133b Mike Christie 2016-01-18 852
attrib->unmap_granularity_alignment = q->limits.discard_alignment /
8a9ebe717a133b Mike Christie 2016-01-18 853
block_size;
8a9ebe717a133b Mike Christie 2016-01-18 854 return true;
8a9ebe717a133b Mike Christie 2016-01-18 855 }
8a9ebe717a133b Mike Christie 2016-01-18 856
EXPORT_SYMBOL(target_configure_unmap_from_queue);
8a9ebe717a133b Mike Christie 2016-01-18 857
:::::: The code at line 846 was first introduced by commit
:::::: ea263c7fada4af8ec7fe5fcfd6e7d7705a89351b target: Fix max_unmap_lba_count
calc overflow
:::::: TO: Mike Christie <[email protected]>
:::::: CC: Nicholas Bellinger <[email protected]>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]