Linux ACPI
 help / color / mirror / Atom feed
* [PATCH][next] ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable
@ 2025-06-24 20:10 Colin Ian King
  2025-06-24 21:10 ` Ira Weiny
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2025-06-24 20:10 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, James Morse, Tony Luck,
	Borislav Petkov, Zaid Alali, Ira Weiny, linux-acpi
  Cc: kernel-janitors, linux-kernel

The check for c < 0 is always false because variable c is a size_t which
is not a signed type. Fix this by making c a ssize_t.

Fixes: 90711f7bdf76 ("ACPI: APEI: EINJ: Create debugfs files to enter device id and syndrome")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/acpi/apei/einj-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index d6d7e36e3647..7930acd1d3f3 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -909,7 +909,7 @@ static ssize_t u128_write(struct file *f, const char __user *buf, size_t count,
 	u8 tmp[COMPONENT_LEN];
 	char byte[3] = {};
 	char *s, *e;
-	size_t c;
+	ssize_t c;
 	long val;
 	int i;
 
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable
  2025-06-24 20:10 [PATCH][next] ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable Colin Ian King
@ 2025-06-24 21:10 ` Ira Weiny
  2025-06-26 18:51   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Ira Weiny @ 2025-06-24 21:10 UTC (permalink / raw)
  To: Colin Ian King, Rafael J . Wysocki, Len Brown, James Morse,
	Tony Luck, Borislav Petkov, Zaid Alali, Ira Weiny, linux-acpi
  Cc: kernel-janitors, linux-kernel

Colin Ian King wrote:
> The check for c < 0 is always false because variable c is a size_t which
> is not a signed type. Fix this by making c a ssize_t.
> 
> Fixes: 90711f7bdf76 ("ACPI: APEI: EINJ: Create debugfs files to enter device id and syndrome")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

[snip]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable
  2025-06-24 21:10 ` Ira Weiny
@ 2025-06-26 18:51   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-06-26 18:51 UTC (permalink / raw)
  To: Ira Weiny, Colin Ian King
  Cc: Len Brown, James Morse, Tony Luck, Borislav Petkov, Zaid Alali,
	linux-acpi, kernel-janitors, linux-kernel

On Tue, Jun 24, 2025 at 11:09 PM Ira Weiny <ira.weiny@intel.com> wrote:
>
> Colin Ian King wrote:
> > The check for c < 0 is always false because variable c is a size_t which
> > is not a signed type. Fix this by making c a ssize_t.
> >
> > Fixes: 90711f7bdf76 ("ACPI: APEI: EINJ: Create debugfs files to enter device id and syndrome")
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-26 18:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 20:10 [PATCH][next] ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable Colin Ian King
2025-06-24 21:10 ` Ira Weiny
2025-06-26 18:51   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox