From: Quentin Schulz <quentin.schulz@cherry.de>
To: Andrew Goodbody <andrew.goodbody@linaro.org>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH] cros_ec: sandbox: Use correct value for number of slots
Date: Mon, 14 Jul 2025 14:23:26 +0200 [thread overview]
Message-ID: <d503ad70-75dc-415c-921e-e89aaed73bb8@cherry.de> (raw)
In-Reply-To: <20250703-cros_ec_sandbox_fix-v1-1-04ac442b8f69@linaro.org>
Hi Andrew,
On 7/3/25 12:00 PM, Andrew Goodbody wrote:
> In the definition of struct ec_state the number of slots that are
> created is VSTORE_SLOT_COUNT (==4) but the value of req->slot is
> checked against EC_VSTORE_SLOT_MAX (==32) so this can lead to memory
> access beyond that allocated.
> Instead change the size check to use VSTORE_SLOT_COUNT to ensure it
> matches what has actually been allocated.
>
> This issue found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Seems reasonable to me:
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
We could have used "ARRAY_SIZE(ec->slot)" instead I believe but the rest
of the code is already using VSTORE_SLOT_COUNT instead, so it makes
sense to stay consistent.
Thanks!
Quentin
next prev parent reply other threads:[~2025-07-14 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 10:00 [PATCH] cros_ec: sandbox: Use correct value for number of slots Andrew Goodbody
2025-07-14 12:23 ` Quentin Schulz [this message]
2025-07-14 23:12 ` Tom Rini
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=d503ad70-75dc-415c-921e-e89aaed73bb8@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=andrew.goodbody@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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