Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors

kernel test robot
2021-11-23T13:31:01Z

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211123]
[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/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211123/202111232117.VwHDjjtU-lkp@intel.com/config.gz)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
# save the config file to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected restricted blk_status_t [usertype] status @@ got int @@
drivers/target/target_core_iblock.c:329:57: sparse: expected restricted blk_status_t [usertype] status
drivers/target/target_core_iblock.c:329:57: sparse: got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected int new @@ got restricted blk_status_t [usertype] bi_status @@
drivers/target/target_core_iblock.c:351:61: sparse: expected int new
drivers/target/target_core_iblock.c:351:61: sparse: got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

319
320 static void iblock_complete_cmd(struct se_cmd *cmd)
321 {
322 struct iblock_req *ibr = cmd->priv;
323 u8 status;
324 sense_reason_t reason;
325
326 if (!refcount_dec_and_test(&ibr->pending))
327 return;
328
> 329 reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
330
331 if (reason != TCM_NO_SENSE)
332 status = SAM_STAT_CHECK_CONDITION;
333 else
334 status = SAM_STAT_GOOD;
335
336 target_complete_cmd_with_sense(cmd, status, reason);
337 kfree(ibr);
338 }
339
340 static void iblock_bio_done(struct bio *bio)
341 {
342 struct se_cmd *cmd = bio->bi_private;
343 struct iblock_req *ibr = cmd->priv;
344
345 if (bio->bi_status) {
346 pr_err("bio error: %p, err: %d\n", bio, bio->bi_status);
347 /*
348 * Set the error status of the iblock request to the error
349 * status of the first failed bio.
350 */
> 351 atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
352 smp_mb__after_atomic();
353 }
354
355 bio_put(bio);
356
357 iblock_complete_cmd(cmd);
358 }
359

---
0-DAY CI Kernel Test Service, Intel Corporation