Module Name:    src
Committed By:   riastradh
Date:           Wed Mar 20 18:47:59 UTC 2024

Modified Files:
        src/sys/dev/acpi: apei_hest.c

Log Message:
apei(4): Pacify -Wsign-compare.

Assert that the parsing made forward progress too while here.

PR kern/58046


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/apei_hest.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/apei_hest.c
diff -u src/sys/dev/acpi/apei_hest.c:1.1 src/sys/dev/acpi/apei_hest.c:1.2
--- src/sys/dev/acpi/apei_hest.c:1.1	Wed Mar 20 17:11:43 2024
+++ src/sys/dev/acpi/apei_hest.c	Wed Mar 20 18:47:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: apei_hest.c,v 1.1 2024/03/20 17:11:43 riastradh Exp $	*/
+/*	$NetBSD: apei_hest.c,v 1.2 2024/03/20 18:47:59 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apei_hest.c,v 1.1 2024/03/20 17:11:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apei_hest.c,v 1.2 2024/03/20 18:47:59 riastradh Exp $");
 
 #include <sys/types.h>
 
@@ -917,7 +917,9 @@ apei_hest_attach(struct apei_softc *sc)
 			    " %"PRIu32"\n", i);
 			break;
 		}
-		KASSERT((const char *)next - (const char *)header <= resid);
+		KASSERT(header < next);
+		KASSERT((size_t)((const char *)next - (const char *)header) <=
+		    resid);
 		resid -= (const char *)next - (const char *)header;
 	}
 	if (resid) {

Reply via email to