From: Nicolas Schichan Date: Tue, 4 Aug 2015 13:19:07 +0000 (+0200) Subject: test_bpf: avoid oopsing the kernel when generate_test_data() fails. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e34684f88efd9cf29ad5ff4750a0f5586383141f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git test_bpf: avoid oopsing the kernel when generate_test_data() fails. Signed-off-by: Nicolas Schichan Acked-by: Alexei Starovoitov Acked-by: Daniel Borkmann Signed-off-by: David S. Miller --- 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);