mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Fix strict mode calculation
"(__LIBBPF_STRICT_LAST - 1) & ~LIBBPF_STRICT_MAP_DEFINITIONS" is wrong
as it is equal to 0 (LIBBPF_STRICT_NONE). Let's use
"LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS" now that the
previous commit makes it possible in libbpf.
Fixes: 93b8952d22
("libbpf: deprecate legacy BPF map definitions")
Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220207145052.124421-3-mauricio@kinvolk.io
This commit is contained in:
parent
e4e835c87b
commit
da7af0aa20
1 changed files with 1 additions and 4 deletions
|
@ -478,14 +478,11 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!legacy_libbpf) {
|
if (!legacy_libbpf) {
|
||||||
enum libbpf_strict_mode mode;
|
|
||||||
|
|
||||||
/* Allow legacy map definitions for skeleton generation.
|
/* Allow legacy map definitions for skeleton generation.
|
||||||
* It will still be rejected if users use LIBBPF_STRICT_ALL
|
* It will still be rejected if users use LIBBPF_STRICT_ALL
|
||||||
* mode for loading generated skeleton.
|
* mode for loading generated skeleton.
|
||||||
*/
|
*/
|
||||||
mode = (__LIBBPF_STRICT_LAST - 1) & ~LIBBPF_STRICT_MAP_DEFINITIONS;
|
ret = libbpf_set_strict_mode(LIBBPF_STRICT_ALL & ~LIBBPF_STRICT_MAP_DEFINITIONS);
|
||||||
ret = libbpf_set_strict_mode(mode);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
p_err("failed to enable libbpf strict mode: %d", ret);
|
p_err("failed to enable libbpf strict mode: %d", ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue