linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples/bpf: Fix map fd argument on tracex4 example
@ 2015-07-24  8:27 Namhyung Kim
  2015-07-24 16:35 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2015-07-24  8:27 UTC (permalink / raw)
  To: Alexei Starovoitov, Ingo Molnar; +Cc: LKML

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 <namhyung@kernel.org>
---
 samples/bpf/tracex4_user.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/samples/bpf/tracex4_user.c b/samples/bpf/tracex4_user.c
index bc4a3bdea6ed..269d78e4ac52 100644
--- a/samples/bpf/tracex4_user.c
+++ b/samples/bpf/tracex4_user.c
@@ -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);
 	}
 
-- 
2.4.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] samples/bpf: Fix map fd argument on tracex4 example
  2015-07-24  8:27 [PATCH] samples/bpf: Fix map fd argument on tracex4 example Namhyung Kim
@ 2015-07-24 16:35 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2015-07-24 16:35 UTC (permalink / raw)
  To: Namhyung Kim, Ingo Molnar; +Cc: LKML, Daniel Borkmann

On 7/24/15 1:27 AM, Namhyung Kim wrote:
> 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<namhyung@kernel.org>

thanks for the fix.
Acked-by: Alexei Starovoitov <ast@plumgrid.com>

the patch won't conflict with any of the work happening in net-next,
so it's fine to route it through tip.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-24 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24  8:27 [PATCH] samples/bpf: Fix map fd argument on tracex4 example Namhyung Kim
2015-07-24 16:35 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).