Skip to contentSkip to conversation

ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable

PATCH Applied Colin Ian King 3 participants 3 messages Jun 24, 2025 – Jun 26, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: APEI: EINJ: Fix less than zero comparison on a size_t variable

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")
---
 drivers/acpi/apei/einj-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/einj-core.c +1 -1
index d6d7e36e3647..7930acd1d3f3 100644
@@ -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;
 
Signature · 1 line
2.50.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Colin Ian King

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")

[snip]

maintainer Applied
#2 lore raw
Quoted 9 lines · Ira Weiny
Quoted 5 lines · Colin Ian King

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")

Applied, thanks!