From: "Cédric Le Goater" <clg@kaod.org>
To: Jamin Lin <jamin_lin@aspeedtech.com>,
Peter Maydell <peter.maydell@linaro.org>,
Steven Lee <steven_lee@aspeedtech.com>,
Troy Lee <leetroy@gmail.com>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Joel Stanley <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: troy_lee@aspeedtech.com, yunlin.tang@aspeedtech.com
Subject: Re: [PATCH v1 1/2] aspeed/soc: fix coverity issue
Date: Mon, 24 Jun 2024 10:44:02 +0200 [thread overview]
Message-ID: <2d0bcf57-0a76-458a-a40f-70a31135e9e5@kaod.org> (raw)
In-Reply-To: <20240619093508.2528537-2-jamin_lin@aspeedtech.com>
On 6/19/24 11:35 AM, Jamin Lin wrote:
> Fix coverity defect: DIVIDE_BY_ZERO.
>
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
I have rewritten the commit log :
aspeed/soc: Fix possible divide by zero
Coverity reports a possible DIVIDE_BY_ZERO issue regarding the
"ram_size" object property. This can not happen because RAM has
predefined valid sizes per SoC. Nevertheless, add a test to
close the issue.
Fixes: Coverity CID 1547113
with that,
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> hw/arm/aspeed_ast27x0.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
> index b6876b4862..d14a46df6f 100644
> --- a/hw/arm/aspeed_ast27x0.c
> +++ b/hw/arm/aspeed_ast27x0.c
> @@ -211,6 +211,12 @@ static void aspeed_ram_capacity_write(void *opaque, hwaddr addr, uint64_t data,
> ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size",
> &error_abort);
>
> + if (!ram_size) {
> + qemu_log_mask(LOG_GUEST_ERROR,
> + "%s: ram_size is zero", __func__);
> + return;
> + }
> +
> /*
> * Emulate ddr capacity hardware behavior.
> * If writes the data to the address which is beyond the ram size,
next prev parent reply other threads:[~2024-06-24 8:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 9:35 [PATCH v1 0/2] Fix coverity issues for AST2700 Jamin Lin via
2024-06-19 9:35 ` [PATCH v1 1/2] aspeed/soc: fix coverity issue Jamin Lin via
2024-06-24 8:44 ` Cédric Le Goater [this message]
2024-06-24 12:18 ` Peter Maydell
2024-06-24 13:58 ` Cédric Le Goater
2024-06-24 14:01 ` Peter Maydell
2024-06-24 14:30 ` Cédric Le Goater
2024-06-25 1:55 ` Jamin Lin
2024-06-25 6:05 ` Cédric Le Goater
2024-06-19 9:35 ` [PATCH v1 2/2] aspeed/sdmc: " Jamin Lin via
2024-06-24 8:45 ` Cédric Le Goater
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=2d0bcf57-0a76-458a-a40f-70a31135e9e5@kaod.org \
--to=clg@kaod.org \
--cc=andrew@codeconstruct.com.au \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
--cc=yunlin.tang@aspeedtech.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).