From: Tom Lendacky <thomas.lendacky@amd.com>
To: Ard Biesheuvel <ardb@kernel.org>,
"Ragavendra B.N." <ragavendra.bn@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com, ashish.kalra@amd.com,
tzimmermann@suse.de, bhelgaas@google.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch:x86:coco:sev: Initialize ctxt variable
Date: Mon, 18 Nov 2024 08:44:54 -0600 [thread overview]
Message-ID: <c7a9748e-aead-b252-dd29-48dd0d2da9be@amd.com> (raw)
In-Reply-To: <CAMj1kXHPut9qv7dT9Xv=xhbS6AP3HRP0dikk-G690AKfLuNLGA@mail.gmail.com>
On 11/15/24 16:55, Ard Biesheuvel wrote:
> On Fri, 15 Nov 2024 at 20:53, Ragavendra B.N. <ragavendra.bn@gmail.com> wrote:
>>
>> On Fri, Nov 15, 2024 at 12:02:27PM +0100, Ard Biesheuvel wrote:
>>> On Fri, 15 Nov 2024 at 12:01, Ingo Molnar <mingo@kernel.org> wrote:
>>>>
>>>>
>>>> * Ragavendra <ragavendra.bn@gmail.com> wrote:
>>>>
>>>>> Updating the ctxt value to NULL in the svsm_perform_ghcb_protocol as
>>>>> it was not initialized.
>>>>>
>>>>> Fixes: 2e1b3cc9d7f7 (grafted) Merge tag 'arm-fixes-6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
>>>>
>>>> This 'Fixes' tag looks bogus.
>>>>
>>>
>>> So does the patch itself - 'struct es_em_ctxt ctxt' is not a pointer.
>> Thank you very much for your response. I am relatively new to kernel development.
>>
>> I know we can use kmalloc for memory allocation. Please advice.
>>
>> struct es_em_ctxt ctxt = kmalloc(sizeof(struct es_em_ctxt), GFP_KERNEL);
>>
>> I am thinking to update like above, but like you mentioned, ctxt is not a pointer. I can update this to be a pointer if needed.
>>
>
> The code is fine as is. Let's end this thread here, shall we?
I was assuming he got some kind of warning from some compiler options or
a static checker. Is that the case Ragavendra?
When I look at the code, it is possible for ctxt->fi.error_code to be
left uninitialized. The simple fix is to just initialize ctxt as:
struct es_em_ctxt ctxt = {};
Thanks,
Tom
next prev parent reply other threads:[~2024-11-18 14:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 0:35 Ragavendra
2024-11-15 11:01 ` Ingo Molnar
2024-11-15 11:02 ` Ard Biesheuvel
2024-11-15 19:53 ` Ragavendra B.N.
2024-11-15 22:55 ` Ard Biesheuvel
2024-11-18 14:44 ` Tom Lendacky [this message]
2024-11-18 14:53 ` Tom Lendacky
2024-11-18 19:43 ` Ragavendra B.N.
2024-11-18 19:50 ` Tom Lendacky
2024-11-18 20:22 ` Ragavendra B.N.
2024-11-18 20:37 ` Tom Lendacky
2024-11-18 21:02 ` Ragavendra B.N.
2024-11-15 18:37 ` Ragavendra B.N.
2024-11-15 19:20 ` Tom Lendacky
2024-11-15 19:22 ` Tom Lendacky
2024-11-15 21:02 ` Ragavendra B.N.
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=c7a9748e-aead-b252-dd29-48dd0d2da9be@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ardb@kernel.org \
--cc=ashish.kalra@amd.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=ragavendra.bn@gmail.com \
--cc=tglx@linutronix.de \
--cc=tzimmermann@suse.de \
--cc=x86@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
all inboxes | Powered by JetHome®