[PATCH] bpftool: fix typo in struct_ops map FD generation for light skeleton

Siddharth Nayyar posted 1 patch 4 days, 13 hours ago
tools/bpf/bpftool/gen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] bpftool: fix typo in struct_ops map FD generation for light skeleton
Posted by Siddharth Nayyar 4 days, 13 hours ago
When generating light skeletons for BPF programs containing struct_ops
maps, bpftool incorrectly outputs a stray literal 't' instead of a tab
character for the map file descriptor member in the links structure.
This causes a compilation error when the generated light skeleton is
used.

Correct the format string by replacing 't' with '\t'.

Fixes: 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton")
Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
---
 tools/bpf/bpftool/gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index 2f9e10752e28..d6040b52d4e1 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -1399,7 +1399,7 @@ static int do_skeleton(int argc, char **argv)
 				continue;
 
 			if (use_loader)
-				printf("t\tint %s_fd;\n", ident);
+				printf("\t\tint %s_fd;\n", ident);
 			else
 				printf("\t\tstruct bpf_link *%s;\n", ident);
 		}

---
base-commit: c6e99c10fd9855082568cbd71bb2cc5dc90eda53
change-id: 20260519-struct_ops_gen_typo_fix-59d53748cece

Best regards,
-- 
Siddharth Nayyar <sidnayyar@google.com>
Re: [PATCH] bpftool: fix typo in struct_ops map FD generation for light skeleton
Posted by Quentin Monnet 4 days, 13 hours ago
2026-05-20 09:40 UTC+0000 ~ Siddharth Nayyar <sidnayyar@google.com>
> When generating light skeletons for BPF programs containing struct_ops
> maps, bpftool incorrectly outputs a stray literal 't' instead of a tab
> character for the map file descriptor member in the links structure.
> This causes a compilation error when the generated light skeleton is
> used.
> 
> Correct the format string by replacing 't' with '\t'.
> 
> Fixes: 08ac454e258e ("libbpf: Auto-attach struct_ops BPF maps in BPF skeleton")
> Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>


Acked-by: Quentin Monnet <qmo@kernel.org>

Thank you!