Module Name:    src
Committed By:   riastradh
Date:           Sun Mar  2 14:18:04 UTC 2025

Modified Files:
        src/sbin/efi: devpath2.c

Log Message:
efi(8): Avoid hard-coding sizeof(devpath_t) as magic constants.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/efi/devpath2.c

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

Modified files:

Index: src/sbin/efi/devpath2.c
diff -u src/sbin/efi/devpath2.c:1.5 src/sbin/efi/devpath2.c:1.6
--- src/sbin/efi/devpath2.c:1.5	Sun Mar  2 01:07:11 2025
+++ src/sbin/efi/devpath2.c	Sun Mar  2 14:18:04 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: devpath2.c,v 1.5 2025/03/02 01:07:11 riastradh Exp $ */
+/* $NetBSD: devpath2.c,v 1.6 2025/03/02 14:18:04 riastradh Exp $ */
 
 /*
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: devpath2.c,v 1.5 2025/03/02 01:07:11 riastradh Exp $");
+__RCSID("$NetBSD: devpath2.c,v 1.6 2025/03/02 14:18:04 riastradh Exp $");
 #endif /* not lint */
 
 #include <assert.h>
@@ -270,7 +270,7 @@ devpath_acpi_unknown(devpath_t *dp, devp
 {
 
 	path->sz = easprintf(&path->cp, "Msg(%d,%s)", dp->SubType,
-	    encode_data(((uint8_t *)dp) + 4, dp->Length - 4));
+	    encode_data((uint8_t *)(dp + 1), dp->Length - sizeof(*dp)));
 
 	if (dbg != NULL) {
 		dbg->sz = easprintf(&dbg->cp,

Reply via email to