From: Eric Auger <eric.auger@redhat.com>
To: Mostafa Saleh <smostafa@google.com>,
qemu-arm@nongnu.org, peter.maydell@linaro.org,
qemu-devel@nongnu.org
Cc: jean-philippe@linaro.org
Subject: Re: [PATCH] hw/arm/smmuv3: Assert input to oas2bits() is valid
Date: Mon, 22 Jul 2024 12:58:20 +0200 [thread overview]
Message-ID: <24401da3-596f-4ded-a367-4048d0565582@redhat.com> (raw)
In-Reply-To: <20240722103531.2377348-1-smostafa@google.com>
On 7/22/24 12:35, Mostafa Saleh wrote:
> Coverity has spotted a possible problem with the OAS handling
> (CID 1558464), where the error return of oas2bits() -1 is not
> checked, which can cause an overflow in oas value.
>
> oas2bits() is only called with valid inputs, harden the function
> to assert that.
>
> Reported-By: Peter Maydell <peter.maydell@linaro.org>
> Link: https://lore.kernel.org/qemu-devel/CAFEAcA-H=n-3mHC+eL6YjfL1m+x+b+Fk3mkgZbN74WNxifFVow@mail.gmail.com/
> Signed-off-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> hw/arm/smmuv3-internal.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
> index 0ebf2eebcf..b6b7399347 100644
> --- a/hw/arm/smmuv3-internal.h
> +++ b/hw/arm/smmuv3-internal.h
> @@ -599,7 +599,8 @@ static inline int oas2bits(int oas_field)
> case 5:
> return 48;
> }
> - return -1;
> +
> + g_assert_not_reached();
> }
>
> /* CD fields */
next prev parent reply other threads:[~2024-07-22 10:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 10:35 [PATCH] hw/arm/smmuv3: Assert input to oas2bits() is valid Mostafa Saleh
2024-07-22 10:50 ` Philippe Mathieu-Daudé
2024-07-22 10:58 ` Eric Auger [this message]
2024-07-25 14:40 ` Peter Maydell
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=24401da3-596f-4ded-a367-4048d0565582@redhat.com \
--to=eric.auger@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=smostafa@google.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;
as well as URLs for NNTP newsgroup(s).