lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 20 Mar 2022 06:08:14 +0000
From:   Yafang Shao <>
        Yafang Shao <>,
        Joanne Koong <>
Subject: [PATCH] bpf: bpftool: fix print error when show bpf map

If there is no btf_id or frozen, it will not show the pids,
but the pids doesn't depends on any one of them.

Below is the result after this change,
$ ./bpftool map show
2: lpm_trie  flags 0x1
	key 8B  value 8B  max_entries 1  memlock 4096B
	pids systemd(1)
3: lpm_trie  flags 0x1
	key 20B  value 8B  max_entries 1  memlock 4096B
	pids systemd(1)

While before this change, the 'pids systemd(1)' can't be displayed.

Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
Signed-off-by: Yafang Shao <>
Cc: Joanne Koong <>
 tools/bpf/bpftool/map.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index f91d9bf9054e..c26378f20831 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -620,17 +620,14 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
 			printf("\n\tpinned %s", (char *)entry->value);
-	printf("\n");
 	if (frozen_str) {
 		frozen = atoi(frozen_str);
-	if (!info->btf_id && !frozen)
-		return 0;
-	printf("\t");
+	if (info->btf_id || frozen)
+		printf("\n\t");
 	if (info->btf_id)
 		printf("btf_id %d", info->btf_id);

Powered by blists - more mailing lists