mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amit Machhiwal <amachhiw@linux.ibm.com>
To: Bui Nguyen Nhu Quynh <kaylovefoss@gmail.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Christophe Leroy <chleroy@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: PPC: Fix callback check in kvmppc_gsm_refresh_info
Date: Wed, 16 Sep 2026 22:14:39 +0530	[thread overview]
Message-ID: <20260916220833.d3e69a6c-3b-amachhiw@linux.ibm.com> (raw)
In-Reply-To: <20260916140742.636708-1-kaylovefoss@gmail.com>

On 2026/09/16 09:07 PM, Bui Nguyen Nhu Quynh wrote:
> The kvmppc_gsm_refresh_info() function incorrectly checks for the
> presence of the fill_info callback instead of refresh_info.
> 
> This can lead to:
> - NULL pointer dereference if refresh_info is NULL but fill_info is present
> - EINVAL return if refresh_info is present but fill_info is NULL
> 
> Fix this by checking the correct callback.
> 
> Fixes: 6ccbbc33f06ad ("KVM: PPC: Add helper library for Guest State Buffers")
> Signed-off-by: Bui Nguyen Nhu Quynh <kaylovefoss@gmail.com>
> ---
> v2:
> - Resend; v1 was mangled by the mail client.  No code changes.
> 
>  arch/powerpc/kvm/guest-state-buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/guest-state-buffer.c b/arch/powerpc/kvm/guest-state-buffer.c
> index 42843eca6727..aeb586ba4523 100644
> --- a/arch/powerpc/kvm/guest-state-buffer.c
> +++ b/arch/powerpc/kvm/guest-state-buffer.c
> @@ -598,7 +598,7 @@ EXPORT_SYMBOL_GPL(kvmppc_gsm_fill_info);
>  int kvmppc_gsm_refresh_info(struct kvmppc_gs_msg *gsm,
>  	struct kvmppc_gs_buff *gsb)

The fix is correct.

However, the patch still does not apply cleanly:

  $ git apply ./v2_...mbx --check --verbose
  error: patch failed: arch/powerpc/kvm/guest-state-buffer.c:598
  error: arch/powerpc/kvm/guest-state-buffer.c: patch does not apply

The index line in the diff (42843eca6727) is a valid blob in the tree, so the
patch base is correct.  The problem is that the context lines in the diff do not
match that blob.  Concretely, the blob at 42843eca6727 has:

  line 599:  \t\t\t    struct kvmppc_gs_buff *gsb)   (3 tabs + 4 spaces)
  line 601:  \t\treturn -EINVAL;                     (2 tabs)

But the patch context has:

  line 599:  \t    struct kvmppc_gs_buff *gsb)        (1 tab + 4 spaces)
  line 601:  \treturn -EINVAL;                        (1 tab)

The indentation on those context lines is being collapsed during patch
generation.  This points to a whitespace handling issue in your git
configuration.

Please review it and then regenerate with git format-patch and verify by
applying the generated patch file onto mainline.  It'll also be a good idea to
rebase your patch on top of mainline before sending v3.

Thanks,
Amit

>  {
> -	if (!gsm->ops->fill_info)
> +	if (!gsm->ops->refresh_info)
>  	return -EINVAL;
>  
>  	return gsm->ops->refresh_info(gsm, gsb);
> -- 
> 2.54.0

      reply	other threads:[~2026-09-16 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 13:26 [PATCH] " nhuquynh
2026-09-07  8:33 ` Gautam Menghani
2026-09-07  9:27 ` Amit Machhiwal
2026-09-16 14:07   ` [PATCH v2] " Bui Nguyen Nhu Quynh
2026-09-16 16:44     ` Amit Machhiwal [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=20260916220833.d3e69a6c-3b-amachhiw@linux.ibm.com \
    --to=amachhiw@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=kaylovefoss@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /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

all inboxes | Powered by JetHome®