Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2026 16:48:29 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 62fbb17e0dd0 - stable/14 - imgact_elf: Unconditionally initialize a variable in a note handler
Message-ID:  <69e112dd.262f1.487abadb@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=62fbb17e0dd03ece12e3e4baad5d0c65bdbde3da

commit 62fbb17e0dd03ece12e3e4baad5d0c65bdbde3da
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-04-08 04:19:56 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-16 16:48:20 +0000

    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
    
    (cherry picked from commit 8a68c2509c00ae0dbeab64064bb600cfac787a73)
---
 sys/kern/imgact_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index a71359a929fb..5261e94846a0 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2685,6 +2685,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),
@@ -2698,7 +2699,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);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e112dd.262f1.487abadb>