aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-04-08 04:19:56 +0000
committerMark Johnston <markj@FreeBSD.org>2026-04-08 14:04:29 +0000
commit8a68c2509c00ae0dbeab64064bb600cfac787a73 (patch)
tree9c34d09cae0e52d64c36aacf39aa3e361cc8a6f1
parent8b5d77bbcbd98e684226950be1c779e108059d8d (diff)
imgact_elf: Unconditionally initialize a variable in a note handler
In the sb == NULL case, we are computing the size of the note using a dummy sbuf drain handler which counts bytes and discards the contents of the buffer, so the fact that "structsize" is uninitialized doesn't matter. But, the compiler may complain about this, so we might as well just initialize it unconditionally to silence the warning, as other handlers already do. PR: 292811 MFC after: 1 week
-rw-r--r--sys/kern/imgact_elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 7410efca4807..c91fd8089487 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2714,6 +2714,7 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep)
int structsize;
p = arg;
+ structsize = sizeof(Elf_Auxinfo);
if (sb == NULL) {
size = 0;
sb = sbuf_new(NULL, NULL, AT_COUNT * sizeof(Elf_Auxinfo),
@@ -2727,7 +2728,6 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep)
sbuf_delete(sb);
*sizep = size;
} else {
- structsize = sizeof(Elf_Auxinfo);
sbuf_bcat(sb, &structsize, sizeof(structsize));
PHOLD(p);
proc_getauxv(curthread, p, sb);