The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nuno Das Neves <nunodasneves@linux.microsoft.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Drivers: hv: mshv: Fix uninitialized variable in hv_call_map_stat_page()
Date: Fri, 21 Mar 2025 09:50:26 -0700	[thread overview]
Message-ID: <b5219734-c1c1-4d3c-953c-92b3c8c23988@linux.microsoft.com> (raw)
In-Reply-To: <fac96458-fdb9-4166-94bd-f1d135abc6ba@stanley.mountain>

On 3/21/2025 7:35 AM, Dan Carpenter wrote:
> If the hv_do_hypercall() succeeds on the first iteration then "ret" is
> not initialized.  I re-arranged this code to make the loop clearer and
> to make it more clear that we return zero on the last line.
> 
> 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_hv_call.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c
> index b72b59a5068b..a74e13a32183 100644
> --- a/drivers/hv/mshv_root_hv_call.c
> +++ b/drivers/hv/mshv_root_hv_call.c
> @@ -733,7 +733,7 @@ int hv_call_map_stat_page(enum hv_stats_object_type type,
>  	u64 status, pfn;
>  	int ret;
>  
> -	do {
> +	while (1) {
>  		local_irq_save(flags);
>  		input = *this_cpu_ptr(hyperv_pcpu_input_arg);
>  		output = *this_cpu_ptr(hyperv_pcpu_output_arg);
> @@ -756,11 +756,11 @@ int hv_call_map_stat_page(enum hv_stats_object_type type,
>  					    hv_current_partition_id, 1);
>  		if (ret)
>  			return ret;
> -	} while (!ret);
> +	}
>  
>  	*addr = page_address(pfn_to_page(pfn));
>  
> -	return ret;
> +	return 0;
>  }
>  
>  int hv_call_unmap_stat_page(enum hv_stats_object_type type,

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/

      reply	other threads:[~2025-03-21 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:35 [PATCH] Drivers: hv: mshv: Fix uninitialized variable in hv_call_map_stat_page() Dan Carpenter
2025-03-21 16:50 ` Nuno Das Neves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5219734-c1c1-4d3c-953c-92b3c8c23988@linux.microsoft.com \
    --to=nunodasneves@linux.microsoft.com \
    --cc=dan.carpenter@linaro.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox