qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: cmd <clement.mathieudrif.etu@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"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: "Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v2 1/2] aspeed/soc: Fix possible divide by zero
Date: Tue, 25 Jun 2024 08:07:27 +0200	[thread overview]
Message-ID: <d698609b-4760-4932-999b-4d4754021421@gmail.com> (raw)
In-Reply-To: <69656db3-24a7-447d-b2b2-49a938744be4@kaod.org>


On 25/06/2024 08:03, Cédric Le Goater wrote:
> On 6/25/24 8:00 AM, cmd wrote:
>> Hi
>>
>> On 25/06/2024 03:50, Jamin Lin via wrote:
>>> 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
>>> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
>>> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>>> [ clg: Rewrote commit log ]
>>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>>> ---
>>>   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;
>>> +    }
>>> +
>> If we are sure that the error cannot happen, shouldn't we assert 
>> instead?
>
> Yes. That is what Peter suggested. This needs to be changed.
>
>
> Thanks,
>
> C.
>
Ok fine, I didn't see the message, sorry!

Thanks

 >cmd

>
>
>>>       /*
>>>        * Emulate ddr capacity hardware behavior.
>>>        * If writes the data to the address which is beyond the ram 
>>> size,
>


  reply	other threads:[~2024-06-25  6:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  1:50 [PATCH v2 0/2] Fix coverity issues for AST2700 Jamin Lin via
2024-06-25  1:50 ` [PATCH v2 1/2] aspeed/soc: Fix possible divide by zero Jamin Lin via
2024-06-25  6:00   ` cmd
2024-06-25  6:03     ` Cédric Le Goater
2024-06-25  6:07       ` cmd [this message]
2024-06-25  6:15         ` Jamin Lin
2024-06-25  6:37           ` Cédric Le Goater
2024-06-25  6:41             ` Jamin Lin
2024-06-25  1:50 ` [PATCH v2 2/2] aspeed/sdmc: Remove extra R_MAIN_STATUS case Jamin Lin via

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=d698609b-4760-4932-999b-4d4754021421@gmail.com \
    --to=clement.mathieudrif.etu@gmail.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=clg@kaod.org \
    --cc=clg@redhat.com \
    --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 \
    /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).