projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4eb94a7
)
bpf: Fix a erroneous check after snprintf()
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Fri, 8 Sep 2023 16:33:35 +0000
(18:33 +0200)
committer
Alexei Starovoitov
<ast@kernel.org>
Tue, 12 Sep 2023 20:15:46 +0000
(13:15 -0700)
snprintf() does not return negative error code on error, it returns the
number of characters which *would* be generated for the given input.
Fix the error handling check.
Fixes: 57539b1c0ac2 ("bpf: Enable annotating trusted nested pointers")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link:
https://lore.kernel.org/r/393bdebc87b22563c08ace094defa7160eb7a6c0.1694190795.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/btf.c
patch
|
blob
|
history
diff --git
a/kernel/bpf/btf.c
b/kernel/bpf/btf.c
index 1095bbe2985930f486010f955d96ee7b57d0a8a1..8090d7fb11ef686019b4734bbc7151057ee78efa 100644
(file)
--- a/
kernel/bpf/btf.c
+++ b/
kernel/bpf/btf.c
@@
-8501,7
+8501,7
@@
bool btf_nested_type_is_trusted(struct bpf_verifier_log *log,
tname = btf_name_by_offset(btf, walk_type->name_off);
ret = snprintf(safe_tname, sizeof(safe_tname), "%s%s", tname, suffix);
- if (ret
< 0
)
+ if (ret
>= sizeof(safe_tname)
)
return false;
safe_id = btf_find_by_name_kind(btf, safe_tname, BTF_INFO_KIND(walk_type->info));