Skip to contentSkip to conversation

lib/bpf_legacy: remove always-true check

PATCH New Maxim Petrov 1 participant 1 message Nov 16, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bpf_legacy: remove always-true check

The 'name' field of the 'struct bpf_prog_info' is a plain C array. Thus, the logical condition in bpf_dump_prog_info() is useless as the array address is always true, so just remove it.

---
 lib/bpf_legacy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
lib/bpf_legacy.c +1 -3
index 3bf08a09..6e3891c9 100644
@@ -203,9 +203,7 @@ int bpf_dump_prog_info(FILE *f, uint32_t id)
 	if (!ret && len) {
 		int jited = !!info.jited_prog_len;
 
-		if (info.name)
-			print_string(PRINT_ANY, "name", "name %s ", info.name);
-
+		print_string(PRINT_ANY, "name", "name %s ", info.name);
 		print_string(PRINT_ANY, "tag", "tag %s ",
 			     hexstring_n2a(info.tag, sizeof(info.tag),
 					   tmp, sizeof(tmp)));
Signature · 1 line
2.25.1