* [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs
@ 2025-05-07 12:58 Dan Carpenter
2025-05-08 13:49 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-05-07 12:58 UTC (permalink / raw)
To: Michał Kopeć
Cc: Hans de Goede, Ilpo Järvinen, Thomas Weißschuh,
platform-driver-x86, linux-kernel, kernel-janitors
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH next] platform/x86: dasharo-acpi: Fix a couple off by one bugs
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
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2025-05-08 13:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Michał Kopeć, Hans de Goede, Thomas Weißschuh,
platform-driver-x86, LKML, kernel-janitors
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-08 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox