[PATCH] samples: bpf: fix: seg fault with NULL pointer arg

2018-12-01 Thread Daniel T. Lee
When NULL pointer accidentally passed to write_kprobe_events, due to strlen(NULL), segmentation fault happens. Changed code returns -1 to deal with this situation. Bug issued with Smatch, static analysis. Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 4 +++- 1 file changed, 3

[PATCH v2] samples: bpf: fix: seg fault with NULL pointer arg

2018-12-03 Thread Daniel T. Lee
When NULL pointer accidentally passed to write_kprobe_events, due to strlen(NULL), segmentation fault happens. Changed code returns -1 to deal with this situation. Bug issued with Smatch, static analysis. Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 4 +++- 1 file changed, 3

[PATCH] samples: bpf: fix: error handling regarding kprobe_events

2018-11-21 Thread Daniel T. Lee
write() directly can verify the command failure, and it will treat all error as -1. So I suggest using write() directly to 'kprobe_events' rather than calling system(). Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 33 - 1 file changed, 24 insertions(+), 9 d

[PATCH v2] samples: bpf: fix: error handling regarding kprobe_events

2018-11-22 Thread Daniel T. Lee
write() directly can verify the command failure, and it will treat all error as -1. So I suggest using write() directly to 'kprobe_events' rather than calling system(). Signed-off-by: Daniel T. Lee --- Changes in v2: - Fix code style at variable declaration. samples/bpf/bpf_load.c | 33 +