From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Michał Kopeć" <michal.kopec@3mdeb.com>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Thomas Weißschuh" <linux@weissschuh.net>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs
Date: Wed, 7 May 2025 15:58:44 +0300 [thread overview]
Message-ID: <aBtZBLNXxaYxMIMr@stanley.mountain> (raw)
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;
--
2.47.2
next reply other threads:[~2025-05-07 12:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 12:58 Dan Carpenter [this message]
2025-05-08 13:49 ` [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs Ilpo Järvinen
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=aBtZBLNXxaYxMIMr@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox