All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/target/target_core_device.c:846:47: warning: shift by negative count ('-10')
@ 2022-06-11 22:32 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-06-11 22:32 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6620 bytes --]

:::::: 
:::::: 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: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Christoph Hellwig <hch@lst.de>
CC: Jens Axboe <axboe@kernel.dk>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Chaitanya Kulkarni <kch@nvidia.com>

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/202206120637.6xDu0WTQ-lkp(a)intel.com/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 <lkp@intel.com>


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 <mchristi@redhat.com>
:::::: CC: Nicholas Bellinger <nab@linux-iscsi.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/target/target_core_device.c:846:47: warning: shift by negative count ('-10')
@ 2022-07-13  3:02 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-07-13  3:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6406 bytes --]

:::::: 
:::::: 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: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Christoph Hellwig <hch@lst.de>
CC: Jens Axboe <axboe@kernel.dk>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Chaitanya Kulkarni <kch@nvidia.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b047602d579b4fb028128a525f056bbdc890e7f0
commit: 817e8b51eb3d927ce6d56ecf9f48bc3c5b26168b target: pass a block_device to target_configure_unmap_from_queue
date:   3 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20220712 (https://download.01.org/0day-ci/archive/20220713/202207131039.g45Ubajt-lkp(a)intel.com/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 <lkp@intel.com>


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/fls.h:17:12:
       |   17 |         if (!x)
       |      |            ^
       |      |            |
       |      |            (4) ...to here
       |      |            (5) following 'true' 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 <mchristi@redhat.com>
:::::: CC: Nicholas Bellinger <nab@linux-iscsi.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-13  3:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 22:32 drivers/target/target_core_device.c:846:47: warning: shift by negative count ('-10') kernel test robot
2022-07-13  3:02 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.