From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Michał Kopeć" <michal.kopec@3mdeb.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Thomas Weißschuh" <linux@weissschuh.net>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs
Date: Thu, 8 May 2025 16:49:39 +0300 (EEST) [thread overview]
Message-ID: <7dac833b-5a47-d168-38b9-ece2d5de2ae5@linux.intel.com> (raw)
In-Reply-To: <aBtZBLNXxaYxMIMr@stanley.mountain>
On Wed, 7 May 2025, Dan Carpenter wrote:
> These two > comparisons should be >= to prevent reading beyond
> the end of the array.
>
> Fixes: 2dd40523b7e2 ("platform/x86: Introduce dasharo-acpi platform driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/platform/x86/dasharo-acpi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/dasharo-acpi.c b/drivers/platform/x86/dasharo-acpi.c
> index f10f52e44641..f0c5136af29d 100644
> --- a/drivers/platform/x86/dasharo-acpi.c
> +++ b/drivers/platform/x86/dasharo-acpi.c
> @@ -101,10 +101,10 @@ static int dasharo_read_channel(struct dasharo_data *data, char *method, enum da
> acpi_status status;
> u64 val;
>
> - if (feat > ARRAY_SIZE(data->capabilities))
> + if (feat >= ARRAY_SIZE(data->capabilities))
> return -EINVAL;
>
> - if (channel > data->caps_found[feat])
> + if (channel >= data->caps_found[feat])
> return -EINVAL;
>
> obj[0].type = ACPI_TYPE_INTEGER;
>
Thanks Dan, I've folded this into the original commit as I was rewriting
history anyway due to some other fixes.
--
i.
prev parent reply other threads:[~2025-05-08 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 12:58 [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs Dan Carpenter
2025-05-08 13:49 ` Ilpo Järvinen [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=7dac833b-5a47-d168-38b9-ece2d5de2ae5@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=dan.carpenter@linaro.org \
--cc=hdegoede@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=michal.kopec@3mdeb.com \
--cc=platform-driver-x86@vger.kernel.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.