Patch "libbpf: Fix single-line struct definition output in btf_dump" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    libbpf: Fix single-line struct definition output in btf_dump

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libbpf-fix-single-line-struct-definition-output-in-b.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 08a512e513568d3a5cba93a1f6b4978c66f92dfd
Author: Andrii Nakryiko <andrii@xxxxxxxxxx>
Date:   Mon Dec 12 13:15:00 2022 -0800

    libbpf: Fix single-line struct definition output in btf_dump
    
    [ Upstream commit 872aec4b5f635d94111d48ec3c57fbe078d64e7d ]
    
    btf_dump APIs emit unnecessary tabs when emitting struct/union
    definition that fits on the single line. Before this patch we'd get:
    
    struct blah {<tab>};
    
    This patch fixes this and makes sure that we get more natural:
    
    struct blah {};
    
    Fixes: 44a726c3f23c ("bpftool: Print newline before '}' for struct with padding only fields")
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20221212211505.558851-2-andrii@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index deb2bc9a0a7b0..69e80ee5f70e2 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -959,9 +959,12 @@ static void btf_dump_emit_struct_def(struct btf_dump *d,
 	 * Keep `struct empty {}` on a single line,
 	 * only print newline when there are regular or padding fields.
 	 */
-	if (vlen || t->size)
+	if (vlen || t->size) {
 		btf_dump_printf(d, "\n");
-	btf_dump_printf(d, "%s}", pfx(lvl));
+		btf_dump_printf(d, "%s}", pfx(lvl));
+	} else {
+		btf_dump_printf(d, "}");
+	}
 	if (packed)
 		btf_dump_printf(d, " __attribute__((packed))");
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux