samples/bpf: Fix map fd argument on tracex4 example
PATCH 1/1 samples/bpf: Fix map fd argument on tracex4 example
It only uses a map so the map_fd[1] should not be accessed. Anyway the print_old_objects didn't use the argument, Fix it.
Signed-off-by Namhyung Kim <[email protected]>
--- samples/bpf/tracex4_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
samples/bpf/tracex4_user.c +3 -3
@@ -37,8 +37,8 @@ static void print_old_objects(int fd) key =write (1 ,"\e[1;1H\e[2J" ,12 );/* clear screen */ key =-1 ; -while (bpf_get_next_key (map_fd[0 ], &key, &next_key) ==0 ) { -bpf_lookup_elem (map_fd[0 ], &next_key, &v); +while (bpf_get_next_key (fd, &key, &next_key) ==0 ) { +bpf_lookup_elem (fd, &next_key, &v); key = next_key;if (val - v.val <1000000000ll )/* object was allocated more then 1 sec ago */
@@ -61,7 +61,7 @@ int main(int ac, char **argv) }for (i =0 ; ; i++) { -print_old_objects (map_fd[1 ]); +print_old_objects (map_fd[0 ]);sleep (1 ); }
Signature · 1 line
2.4.6
Quoted 4 lines · Namhyung Kim
It only uses a map so the map_fd[1] should not be accessed. Anyway the
print_old_objectsdidn't use the argument, Fix it.Signed-off-by Namhyung Kim<[email protected]>
thanks for the fix.
the patch won't conflict with any of the work happening in net-next, so it's fine to route it through tip.