[mcgrof-next:20210820-add-disk-error-handling-next 89/90] drivers/block/floppy.c:4540 floppy_probe() error: uninitialized symbol 'err'.

From: Dan Carpenter
Date: Fri Aug 27 2021 - 04:09:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210820-add-disk-error-handling-next
head: 9a845121f1e14033032e7cbb772ca21f24be0cb3
commit: b08dbe6faf0fc2f3589d5e9b191899b7d9ab0b6d [89/90] block: make __register_blkdev() return an error
config: i386-randconfig-m021-20210827 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

New smatch warnings:
drivers/block/floppy.c:4540 floppy_probe() error: uninitialized symbol 'err'.

Old smatch warnings:
drivers/block/floppy.c:2794 redo_fd_request() error: we previously assumed 'current_req' could be null (see line 2782)
drivers/block/floppy.c:3543 fd_locked_ioctl() error: uninitialized symbol 'outparam'.

vim +/err +4540 drivers/block/floppy.c

b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4520 static int floppy_probe(dev_t dev)
302cfee150291c Christoph Hellwig 2020-10-29 4521 {
302cfee150291c Christoph Hellwig 2020-10-29 4522 unsigned int drive = (MINOR(dev) & 3) | ((MINOR(dev) & 0x80) >> 5);
302cfee150291c Christoph Hellwig 2020-10-29 4523 unsigned int type = (MINOR(dev) >> 2) & 0x1f;
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4524 int err;
302cfee150291c Christoph Hellwig 2020-10-29 4525
302cfee150291c Christoph Hellwig 2020-10-29 4526 if (drive >= N_DRIVE || !floppy_available(drive) ||
302cfee150291c Christoph Hellwig 2020-10-29 4527 type >= ARRAY_SIZE(floppy_type))
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4528 return -EINVAL;
302cfee150291c Christoph Hellwig 2020-10-29 4529
302cfee150291c Christoph Hellwig 2020-10-29 4530 mutex_lock(&floppy_probe_lock);
302cfee150291c Christoph Hellwig 2020-10-29 4531 if (!disks[drive][type]) {
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4532 if (floppy_alloc_disk(drive, type) == 0) {
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4533 err = add_disk(disks[drive][type]);
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4534 if (err)
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4535 blk_cleanup_disk(disks[drive][type]);
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4536 }

"err" not set on else path.

302cfee150291c Christoph Hellwig 2020-10-29 4537 }
302cfee150291c Christoph Hellwig 2020-10-29 4538 mutex_unlock(&floppy_probe_lock);
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 4539
b08dbe6faf0fc2 Luis Chamberlain 2021-07-14 @4540 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 4541 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx