CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Damien Le Moal <[email protected]>
TO: [email protected]
TO: Jens Axboe <[email protected]>
TO: [email protected]
TO: "Martin K . Petersen" <[email protected]>
TO: [email protected]

Hi Damien,

I love your patch! Perhaps something to improve:

[auto build test WARNING on block/for-next]
[also build test WARNING on scsi/for-next mkp-scsi/for-next v5.14-rc2 
next-20210721]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Damien-Le-Moal/Initial-support-for-multi-actuator-HDDs/20210721-185447
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: x86_64-randconfig-m001-20210720 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/scsi/sd.c:3204 sd_read_cpr() error: uninitialized symbol 'buffer'.

vim +/buffer +3204 drivers/scsi/sd.c

331fc9cf44c011 Damien Le Moal 2021-07-21  3132  
331fc9cf44c011 Damien Le Moal 2021-07-21  3133  /**
331fc9cf44c011 Damien Le Moal 2021-07-21  3134   * sd_read_cpr - Query 
concurrent positioning ranges
331fc9cf44c011 Damien Le Moal 2021-07-21  3135   * @sdkp:       disk to query
331fc9cf44c011 Damien Le Moal 2021-07-21  3136   */
331fc9cf44c011 Damien Le Moal 2021-07-21  3137  static void sd_read_cpr(struct 
scsi_disk *sdkp)
331fc9cf44c011 Damien Le Moal 2021-07-21  3138  {
331fc9cf44c011 Damien Le Moal 2021-07-21  3139          unsigned char *buffer, 
*desc;
331fc9cf44c011 Damien Le Moal 2021-07-21  3140          struct blk_cranges *cr 
= NULL;
331fc9cf44c011 Damien Le Moal 2021-07-21  3141          unsigned int nr_cpr = 0;
331fc9cf44c011 Damien Le Moal 2021-07-21  3142          int i, vpd_len, buf_len 
= SD_BUF_SIZE;
331fc9cf44c011 Damien Le Moal 2021-07-21  3143  
331fc9cf44c011 Damien Le Moal 2021-07-21  3144          /*
331fc9cf44c011 Damien Le Moal 2021-07-21  3145           * We need to have the 
capacity set first for the block layer to be
331fc9cf44c011 Damien Le Moal 2021-07-21  3146           * able to check the 
ranges.
331fc9cf44c011 Damien Le Moal 2021-07-21  3147           */
331fc9cf44c011 Damien Le Moal 2021-07-21  3148          if (sdkp->first_scan)
331fc9cf44c011 Damien Le Moal 2021-07-21  3149                  return;
331fc9cf44c011 Damien Le Moal 2021-07-21  3150  
331fc9cf44c011 Damien Le Moal 2021-07-21  3151          if (!sdkp->capacity)
331fc9cf44c011 Damien Le Moal 2021-07-21  3152                  goto out;
331fc9cf44c011 Damien Le Moal 2021-07-21  3153  
331fc9cf44c011 Damien Le Moal 2021-07-21  3154          /*
331fc9cf44c011 Damien Le Moal 2021-07-21  3155           * Concurrent 
Positioning Ranges VPD: there can be at most 256 ranges,
331fc9cf44c011 Damien Le Moal 2021-07-21  3156           * leading to a maximum 
page size of 64 + 256*32 bytes.
331fc9cf44c011 Damien Le Moal 2021-07-21  3157           */
331fc9cf44c011 Damien Le Moal 2021-07-21  3158          buf_len = 64 + 256*32;
331fc9cf44c011 Damien Le Moal 2021-07-21  3159          buffer = 
kmalloc(buf_len, GFP_KERNEL);
331fc9cf44c011 Damien Le Moal 2021-07-21  3160          if (!buffer || 
scsi_get_vpd_page(sdkp->device, 0xb9, buffer, buf_len))
331fc9cf44c011 Damien Le Moal 2021-07-21  3161                  goto out;
331fc9cf44c011 Damien Le Moal 2021-07-21  3162  
331fc9cf44c011 Damien Le Moal 2021-07-21  3163          /* We must have at 
least a 64B header and one 32B range descriptor */
331fc9cf44c011 Damien Le Moal 2021-07-21  3164          vpd_len = 
get_unaligned_be16(&buffer[2]) + 3;
331fc9cf44c011 Damien Le Moal 2021-07-21  3165          if (vpd_len > buf_len 
|| vpd_len < 64 + 32 || (vpd_len & 31)) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3166                  
sd_printk(KERN_ERR, sdkp,
331fc9cf44c011 Damien Le Moal 2021-07-21  3167                            
"Invalid Concurrent Positioning Ranges VPD page\n");
331fc9cf44c011 Damien Le Moal 2021-07-21  3168                  goto out;
331fc9cf44c011 Damien Le Moal 2021-07-21  3169          }
331fc9cf44c011 Damien Le Moal 2021-07-21  3170  
331fc9cf44c011 Damien Le Moal 2021-07-21  3171          nr_cpr = (vpd_len - 64) 
/ 32;
331fc9cf44c011 Damien Le Moal 2021-07-21  3172          if (nr_cpr == 1) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3173                  nr_cpr = 0;
331fc9cf44c011 Damien Le Moal 2021-07-21  3174                  goto out;
331fc9cf44c011 Damien Le Moal 2021-07-21  3175          }
331fc9cf44c011 Damien Le Moal 2021-07-21  3176  
331fc9cf44c011 Damien Le Moal 2021-07-21  3177          cr = 
blk_alloc_cranges(sdkp->disk, nr_cpr);
331fc9cf44c011 Damien Le Moal 2021-07-21  3178          if (!cr) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3179                  nr_cpr = 0;
331fc9cf44c011 Damien Le Moal 2021-07-21  3180                  goto out;
331fc9cf44c011 Damien Le Moal 2021-07-21  3181          }
331fc9cf44c011 Damien Le Moal 2021-07-21  3182  
331fc9cf44c011 Damien Le Moal 2021-07-21  3183          desc = &buffer[64];
331fc9cf44c011 Damien Le Moal 2021-07-21  3184          for (i = 0; i < nr_cpr; 
i++, desc += 32) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3185                  if (desc[0] != 
i) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3186                          
sd_printk(KERN_ERR, sdkp,
331fc9cf44c011 Damien Le Moal 2021-07-21  3187                                  
"Invalid Concurrent Positioning Range number\n");
331fc9cf44c011 Damien Le Moal 2021-07-21  3188                          nr_cpr 
= 0;
331fc9cf44c011 Damien Le Moal 2021-07-21  3189                          break;
331fc9cf44c011 Damien Le Moal 2021-07-21  3190                  }
331fc9cf44c011 Damien Le Moal 2021-07-21  3191  
331fc9cf44c011 Damien Le Moal 2021-07-21  3192                  
cr->ranges[i].sector = sd64_to_sectors(sdkp, desc + 8);
331fc9cf44c011 Damien Le Moal 2021-07-21  3193                  
cr->ranges[i].nr_sectors = sd64_to_sectors(sdkp, desc + 16);
331fc9cf44c011 Damien Le Moal 2021-07-21  3194          }
331fc9cf44c011 Damien Le Moal 2021-07-21  3195  
331fc9cf44c011 Damien Le Moal 2021-07-21  3196  out:
331fc9cf44c011 Damien Le Moal 2021-07-21  3197          
blk_queue_set_cranges(sdkp->disk, cr);
331fc9cf44c011 Damien Le Moal 2021-07-21  3198          if (nr_cpr && 
sdkp->nr_actuators != nr_cpr) {
331fc9cf44c011 Damien Le Moal 2021-07-21  3199                  
sd_printk(KERN_NOTICE, sdkp,
331fc9cf44c011 Damien Le Moal 2021-07-21  3200                            "%u 
concurrent positioning ranges\n", nr_cpr);
331fc9cf44c011 Damien Le Moal 2021-07-21  3201                  
sdkp->nr_actuators = nr_cpr;
331fc9cf44c011 Damien Le Moal 2021-07-21  3202          }
331fc9cf44c011 Damien Le Moal 2021-07-21  3203  
331fc9cf44c011 Damien Le Moal 2021-07-21 @3204          kfree(buffer);
331fc9cf44c011 Damien Le Moal 2021-07-21  3205  }
331fc9cf44c011 Damien Le Moal 2021-07-21  3206  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to