diff options
| author | Alex Richardson <arichardson@FreeBSD.org> | 2025-09-15 06:27:12 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2026-04-25 13:42:16 +0000 |
| commit | 753a166bdeb3aeba02fd9678e7360f0929007368 (patch) | |
| tree | 89e4c753a559104672aa6f95b70015d9beda56b0 | |
| parent | 7262e60119b8840ee400d281421b8e65d8af9d84 (diff) | |
imgact_elf: Fix uninitialized variable use in note_procstat_auxv
Found building with latest clang
MFC after: 3 days
| -rw-r--r-- | sys/kern/imgact_elf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index af0841c75549..3c5fbe4df342 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -2712,13 +2712,16 @@ __elfN(note_procstat_auxv)(void *arg, struct sbuf *sb, size_t *sizep) struct proc *p; size_t size; int structsize; - +#if defined(COMPAT_FREEBSD32) && __ELF_WORD_SIZE == 32 + structsize = sizeof(Elf32_Auxinfo); +#else + structsize = sizeof(Elf_Auxinfo); +#endif p = arg; structsize = sizeof(Elf_Auxinfo); if (sb == NULL) { size = 0; - sb = sbuf_new(NULL, NULL, AT_COUNT * sizeof(Elf_Auxinfo), - SBUF_FIXEDLEN); + sb = sbuf_new(NULL, NULL, AT_COUNT * structsize, SBUF_FIXEDLEN); sbuf_set_drain(sb, sbuf_count_drain, &size); sbuf_bcat(sb, &structsize, sizeof(structsize)); PHOLD(p); |
