Skip to contentSkip to conversation

block: floppy: Fix uninitialized use of outparam

PATCH Applied Purva Yeshi 3 participants 5 messages Jul 13, 2025 – Jul 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block: floppy: Fix uninitialized use of outparam

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.

---
V1 - https://lore.kernel.org/all/[email protected]/T/#t
V2 - Initialize outparam to NULL to suppress Smatch false positive.

 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/floppy.c +1 -1
index e97432032f01..24be0c2c4075 100644
@@ -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
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · Purva Yeshi

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.

---
V1 - https://lore.kernel.org/all/[email protected]/T/#t
V2 - Initialize outparam to NULL to suppress Smatch false positive.

 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/floppy.c +0 -0
index e97432032f01..24be0c2c4075 100644

drivers/block/floppy.c static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode, · line 3417

Quoted 8 lines
drivers/block/floppy.c +1 -1
@@ -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

Denis

#2 lore raw
Quoted 31 lines · Denis Efremov
Quoted 28 lines · Purva Yeshi

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.

---
V1 - https://lore.kernel.org/all/[email protected]/T/#t
V2 - Initialize outparam to NULL to suppress Smatch false positive.

  drivers/block/floppy.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/floppy.c +1 -1
index e97432032f01..24be0c2c4075 100644
@@ -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 */
 
Quoted 6 lines

drivers/block/floppy.c static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode, · line 3417

Quoted 2 lines
drivers/block/floppy.c +0 -0
  	/* convert compatibility eject ioctls into floppy eject ioctl.
  	 * We do this in order to provide a means to eject floppy disks before

Denis

Hi,

Thank you for the review and for adding your Reviewed-by tag.

maintainer Applied
#3 lore raw
In reply to Purva Yeshi
Quoted 10 lines · Purva Yeshi

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.

[...]

Applied, thanks!

[1/1] block: floppy: Fix uninitialized use of outparam

      commit: cb1bdf0797acd79c53a899f72a06ab8c1ebc5bcb

Best regards,

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 11 lines · Jens Axboe
Quoted 9 lines · Purva Yeshi

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.

Quoted 8 lines
Quoted 1 line

[...]

Applied, thanks!

[1/1] block: floppy: Fix uninitialized use of outparam

       commit: cb1bdf0797acd79c53a899f72a06ab8c1ebc5bcb

Best regards,

Hi Jens,

Thank you for applying the patch.

Best regards,
Purva Yeshi