linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] Drivers: hv: mshv: Fix uninitialize variable in mshv_ioctl_passthru_hvcall()
@ 2025-03-21 14:35 Dan Carpenter
  2025-03-21 16:49 ` Nuno Das Neves
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-03-21 14:35 UTC (permalink / raw)
  To: Nuno Das Neves
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Praveen K Paladugu, Roman Kisel, Jinank Jain, Mukesh Rathor,
	linux-hyperv, linux-kernel, kernel-janitors

The "ret" variable could be uninitialized on the success path depending
on if "is_async" is true of false.  Initialized it to zero.

Fixes: f5288d14069b ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/hv/mshv_root_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
index 29fa6d5a3994..b94d8fe0f691 100644
--- a/drivers/hv/mshv_root_main.c
+++ b/drivers/hv/mshv_root_main.c
@@ -151,13 +151,14 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition,
 				      void __user *user_args)
 {
 	u64 status;
-	int ret, i;
 	bool is_async;
 	struct mshv_root_hvcall args;
 	struct page *page;
 	unsigned int pages_order;
 	void *input_pg = NULL;
 	void *output_pg = NULL;
+	int ret = 0;
+	int i;
 
 	if (copy_from_user(&args, user_args, sizeof(args)))
 		return -EFAULT;
-- 
2.47.2


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

* Re: [PATCH next] Drivers: hv: mshv: Fix uninitialize variable in mshv_ioctl_passthru_hvcall()
  2025-03-21 14:35 [PATCH next] Drivers: hv: mshv: Fix uninitialize variable in mshv_ioctl_passthru_hvcall() Dan Carpenter
@ 2025-03-21 16:49 ` Nuno Das Neves
  0 siblings, 0 replies; 2+ messages in thread
From: Nuno Das Neves @ 2025-03-21 16:49 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Praveen K Paladugu, Roman Kisel, Jinank Jain, Mukesh Rathor,
	linux-hyperv, linux-kernel, kernel-janitors

On 3/21/2025 7:35 AM, Dan Carpenter wrote:
> The "ret" variable could be uninitialized on the success path depending
> on if "is_async" is true of false.  Initialized it to zero.
> 
> Fixes: f5288d14069b ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/hv/mshv_root_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
> index 29fa6d5a3994..b94d8fe0f691 100644
> --- a/drivers/hv/mshv_root_main.c
> +++ b/drivers/hv/mshv_root_main.c
> @@ -151,13 +151,14 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition,
>  				      void __user *user_args)
>  {
>  	u64 status;
> -	int ret, i;
>  	bool is_async;
>  	struct mshv_root_hvcall args;
>  	struct page *page;
>  	unsigned int pages_order;
>  	void *input_pg = NULL;
>  	void *output_pg = NULL;
> +	int ret = 0;
> +	int i;
>  
>  	if (copy_from_user(&args, user_args, sizeof(args)))
>  		return -EFAULT;

Thanks Dan, I already sent a fixup for this:
https://lore.kernel.org/linux-hyperv/1742492693-21960-1-git-send-email-nunodasneves@linux.microsoft.com/

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

end of thread, other threads:[~2025-03-21 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 14:35 [PATCH next] Drivers: hv: mshv: Fix uninitialize variable in mshv_ioctl_passthru_hvcall() Dan Carpenter
2025-03-21 16:49 ` Nuno Das Neves

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).