linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] block: floppy: Fix uninitialized use of outparam
@ 2025-07-13  7:00 Purva Yeshi
  2025-07-13  8:47 ` Denis Efremov
  2025-07-13 18:08 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Purva Yeshi @ 2025-07-13  7:00 UTC (permalink / raw)
  To: efremov, axboe; +Cc: linux-block, linux-kernel, 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.

Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
---
V1 - https://lore.kernel.org/all/7dd94691-0b37-4855-be43-661f954275c8@gmail.com/T/#t
V2 - Initialize outparam to NULL to suppress Smatch false positive.

 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index e97432032f01..24be0c2c4075 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] block: floppy: Fix uninitialized use of outparam
  2025-07-13  7:00 [PATCH v2] block: floppy: Fix uninitialized use of outparam Purva Yeshi
@ 2025-07-13  8:47 ` Denis Efremov
  2025-07-14  5:00   ` Purva Yeshi
  2025-07-13 18:08 ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Denis Efremov @ 2025-07-13  8:47 UTC (permalink / raw)
  To: Purva Yeshi, axboe; +Cc: linux-block, linux-kernel



On 13/07/2025 11:00, Purva Yeshi wrote:
> 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>
> ---
> V1 - https://lore.kernel.org/all/7dd94691-0b37-4855-be43-661f954275c8@gmail.com/T/#t
> V2 - Initialize outparam to NULL to suppress Smatch false positive.
> 
>  drivers/block/floppy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index e97432032f01..24be0c2c4075 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -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

Reviewed-by: Denis Efremov <efremov@linux.com>

Denis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] block: floppy: Fix uninitialized use of outparam
  2025-07-13  7:00 [PATCH v2] block: floppy: Fix uninitialized use of outparam Purva Yeshi
  2025-07-13  8:47 ` Denis Efremov
@ 2025-07-13 18:08 ` Jens Axboe
  2025-07-14  5:01   ` Purva Yeshi
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-07-13 18:08 UTC (permalink / raw)
  To: efremov, Purva Yeshi; +Cc: linux-block, linux-kernel


On Sun, 13 Jul 2025 12:30:20 +0530, Purva Yeshi wrote:
> 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,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] block: floppy: Fix uninitialized use of outparam
  2025-07-13  8:47 ` Denis Efremov
@ 2025-07-14  5:00   ` Purva Yeshi
  0 siblings, 0 replies; 5+ messages in thread
From: Purva Yeshi @ 2025-07-14  5:00 UTC (permalink / raw)
  To: efremov, axboe; +Cc: linux-block, linux-kernel

On 13/07/25 14:17, Denis Efremov wrote:
> 
> 
> On 13/07/2025 11:00, Purva Yeshi wrote:
>> 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>
>> ---
>> V1 - https://lore.kernel.org/all/7dd94691-0b37-4855-be43-661f954275c8@gmail.com/T/#t
>> V2 - Initialize outparam to NULL to suppress Smatch false positive.
>>
>>   drivers/block/floppy.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
>> index e97432032f01..24be0c2c4075 100644
>> --- a/drivers/block/floppy.c
>> +++ b/drivers/block/floppy.c
>> @@ -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
> 
> Reviewed-by: Denis Efremov <efremov@linux.com>
> 
> Denis

Hi,

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] block: floppy: Fix uninitialized use of outparam
  2025-07-13 18:08 ` Jens Axboe
@ 2025-07-14  5:01   ` Purva Yeshi
  0 siblings, 0 replies; 5+ messages in thread
From: Purva Yeshi @ 2025-07-14  5:01 UTC (permalink / raw)
  To: Jens Axboe, efremov; +Cc: linux-block, linux-kernel

On 13/07/25 23:38, Jens Axboe wrote:
> 
> On Sun, 13 Jul 2025 12:30:20 +0530, Purva Yeshi wrote:
>> 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,

Hi Jens,

Thank you for applying the patch.

Best regards,
Purva Yeshi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-14  5:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-13  7:00 [PATCH v2] block: floppy: Fix uninitialized use of outparam Purva Yeshi
2025-07-13  8:47 ` Denis Efremov
2025-07-14  5:00   ` Purva Yeshi
2025-07-13 18:08 ` Jens Axboe
2025-07-14  5:01   ` Purva Yeshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).