]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: floppy: Fix uninitialized use of outparam
authorPurva Yeshi <purvayeshi550@gmail.com>
Sun, 13 Jul 2025 07:00:20 +0000 (12:30 +0530)
committerJens Axboe <axboe@kernel.dk>
Sun, 13 Jul 2025 18:08:31 +0000 (12:08 -0600)
Fix Smatch-detected error:
drivers/block/floppy.c:3569 fd_locked_ioctl() error:
uninitialized symbol 'outparam'.

Smatch may incorrectly warn about uninitialized use of 'outparam'
in fd_locked_ioctl(), even though all _IOC_READ commands guarantee
its initialization. Initialize outparam to NULL to make this explicit
and suppress the false positive.

Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
Reviewed-by: Denis Efremov <efremov@linux.com>
Link: https://lore.kernel.org/r/20250713070020.14530-1-purvayeshi550@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/floppy.c

index e97432032f014486c4e083d5ccc820a18762bb71..24be0c2c4075c5c61e2ce976421e26edeeed3f69 100644 (file)
@@ -3411,7 +3411,7 @@ static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode,
                struct floppy_max_errors max_errors;
                struct floppy_drive_params dp;
        } inparam;              /* parameters coming from user space */
-       const void *outparam;   /* parameters passed back to user space */
+       const void *outparam = NULL;    /* parameters passed back to user space */
 
        /* convert compatibility eject ioctls into floppy eject ioctl.
         * We do this in order to provide a means to eject floppy disks before