All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Huang <wei.huang2@amd.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com,
	richard.henderson@linaro.org,  eduardo@habkost.net,
	mst@redhat.com, marcel.apfelbaum@gmail.com, jasowang@redhat.com,
	peterx@redhat.com, Suravee.Suthikulpanit@amd.com
Subject: Re: [PATCH 1/1] hw/i386/amd_iommu: Fix IOMMU event log encoding errors
Date: Thu, 21 Apr 2022 11:19:45 -0500	[thread overview]
Message-ID: <6ee010fe-bfdc-4c05-28ab-8b3faa63e05e@amd.com> (raw)
In-Reply-To: <CAFEAcA9MLba1b=ZPeWkRqp4nE3dZUJ7q73MALeSHXdsOUnrjug@mail.gmail.com>



On 4/21/22 11:08, Peter Maydell wrote:
> On Thu, 21 Apr 2022 at 17:01, Wei Huang <wei.huang2@amd.com> wrote:
>>
>> Coverity issues several UNINIT warnings against AMD IOMMU device [1]. This
>> patch fixes them by initializing the variables. On top of it, this patch
>> changes the event log size to 16 bytes per IOMMU specification. Also the
>> event encoding function incorrectly defines the format of event log entry,
>> which is also fixed.
>>
>> [1] CID 1487116/1487200/1487190/1487232/1487115/1487258
>>
>> Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Wei Huang <wei.huang2@amd.com>
>> ---
>>   hw/i386/amd_iommu.c | 17 +++++++++--------
>>   1 file changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
>> index ea8eaeb330b6..0f7f8929a687 100644
>> --- a/hw/i386/amd_iommu.c
>> +++ b/hw/i386/amd_iommu.c
>> @@ -208,8 +208,8 @@ static void amdvi_encode_event(uint64_t *evt, uint16_t devid, uint64_t addr,
>>                                  uint16_t info)
>>   {
>>       amdvi_setevent_bits(evt, devid, 0, 16);
>> -    amdvi_setevent_bits(evt, info, 55, 8);
>> -    amdvi_setevent_bits(evt, addr, 63, 64);
>> +    amdvi_setevent_bits(evt, info, 48, 16);
>> +    amdvi_setevent_bits(evt, addr, 64, 64);
> 
> There's a comment just above this function which also needs updating.

Will do.

> 
> Would it be better to have this function start with
>    evt[0] = 0;
>    evt[1] = 0;
> 
> rather than requiring every caller to zero-initialize the buffer?

Assuming that Coverity is smart enough to poke one function further for 
checking UNINIT, I will fix it in the next spin. I will send another rev 
later today.

> 
> thanks
> -- PMM


      reply	other threads:[~2022-04-21 16:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 16:01 [PATCH 1/1] hw/i386/amd_iommu: Fix IOMMU event log encoding errors Wei Huang
2022-04-21 16:08 ` Peter Maydell
2022-04-21 16:19   ` Wei Huang [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=6ee010fe-bfdc-4c05-28ab-8b3faa63e05e@amd.com \
    --to=wei.huang2@amd.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=eduardo@habkost.net \
    --cc=jasowang@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.