Skip to contentSkip to conversation

bpf: btf: fix inconsistent IS_ERR and PTR_ERR

PATCH Applied YueHaibing 5 participants 5 messages Jul 24, 2018 – Jul 25, 2018

Subsystems (4)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 bpf: btf: fix inconsistent IS_ERR and PTR_ERR

Fix inconsistent IS_ERR and PTR_ERR in get_btf, the proper pointer to be passed as argument is '*btf'

This issue was detected with the help of Coccinelle.

Fixes 2d3feca8c44f ("bpf: btf: print map dump and lookup with btf info")
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/map.c +1 -1
index 9c81918..0ee3ba4 100644
@@ -230,7 +230,7 @@ static int get_btf(struct bpf_map_info *map_info, struct btf **btf)
 
 	*btf = btf__new((__u8 *)btf_info.btf, btf_info.btf_size, NULL);
 	if (IS_ERR(*btf)) {
-		err = PTR_ERR(btf);
+		err = PTR_ERR(*btf);
 		*btf = NULL;
 	}
 
Signature · 1 line
2.7.0
Acked-by on v1 1/1
#3 lore raw
In reply to YueHaibing
Quoted 7 lines · YueHaibing

Fix inconsistent IS_ERR and PTR_ERR in get_btf, the proper pointer to be passed as argument is '*btf'

This issue was detected with the help of Coccinelle.

Fixes 2d3feca8c44f ("bpf: btf: print map dump and lookup with btf info")
Quoted 21 lines
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/map.c +1 -1
index 9c81918..0ee3ba4 100644
@@ -230,7 +230,7 @@ static int get_btf(struct bpf_map_info *map_info, struct btf **btf)
 
 	*btf = btf__new((__u8 *)btf_info.btf, btf_info.btf_size, NULL);
 	if (IS_ERR(*btf)) {
-		err = PTR_ERR(btf);
+		err = PTR_ERR(*btf);
 		*btf = NULL;
 	}
 
Signature · 1 line
2.7.0
maintainer Applied
#4 lore raw
In reply to YueHaibing
Quoted 7 lines · YueHaibing

Fix inconsistent IS_ERR and PTR_ERR in get_btf, the proper pointer to be passed as argument is '*btf'

This issue was detected with the help of Coccinelle.

Fixes 2d3feca8c44f ("bpf: btf: print map dump and lookup with btf info")

Applied to bpf-next, thanks Yue!