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
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
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
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 +