summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNicolas Schichan <nschichan@freebox.fr>2015-08-04 15:19:07 +0200
committerDavid S. Miller <davem@davemloft.net>2015-08-06 22:02:31 -0700
commite34684f88efd9cf29ad5ff4750a0f5586383141f (patch)
tree4b6022d89a881b2c61c7978040b6184449664148 /lib
parentc71b5ad06e7306f73815cd64a5fe039a67126c99 (diff)
downloadlinux-e34684f88efd9cf29ad5ff4750a0f5586383141f.tar.bz2
test_bpf: avoid oopsing the kernel when generate_test_data() fails.
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_bpf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 3afddf2026c9..6843d0b62032 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -4672,6 +4672,11 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test)
break;
data = generate_test_data(test, i);
+ if (!data && !(test->aux & FLAG_NO_DATA)) {
+ pr_cont("data generation failed ");
+ err_cnt++;
+ break;
+ }
ret = __run_one(fp, data, runs, &duration);
release_test_data(test, data);