Module Name:    src
Committed By:   riastradh
Date:           Sun Mar 30 14:30:40 UTC 2025

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

Log Message:
efi(8): EFI_VARNAME_MAXLENGTH is in bytes, not CHAR16.

Same with struct efi_var_ioc::namesize.

This shouldn't change the semantics of the program -- it was just
allocating twice the maximum buffer space that the kernel would ever
actually use; now it only allocates exactly the maximum buffer space
that the kernel will ever actually use.

Prompted by (but will not fix):

PR kern/59235: efi(8) panics


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/efi/efiio.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/efiio.c
diff -u src/sbin/efi/efiio.c:1.2 src/sbin/efi/efiio.c:1.3
--- src/sbin/efi/efiio.c:1.2	Sun Mar  2 00:03:41 2025
+++ src/sbin/efi/efiio.c	Sun Mar 30 14:30:40 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: efiio.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $ */
+/* $NetBSD: efiio.c,v 1.3 2025/03/30 14:30:40 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: efiio.c,v 1.2 2025/03/02 00:03:41 riastradh Exp $");
+__RCSID("$NetBSD: efiio.c,v 1.3 2025/03/30 14:30:40 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/efiio.h>
@@ -140,7 +140,7 @@ get_variable_info(int fd, bool (*choose)
 
 	memset(&ev, 0, sizeof(ev));
 
-	ev.name = ecalloc(EFI_VARNAME_MAXLENGTH, sizeof(*ev.name));
+	ev.name = ecalloc(EFI_VARNAME_MAXLENGTH, 1);
 	cnt = 0;
 	for (;;) {
 		ev.namesize = EFI_VARNAME_MAXLENGTH;

Reply via email to