bpf: btf: Check array t->size
authorMartin KaFai Lau <kafai@fb.com>
Sat, 2 Jun 2018 16:06:50 +0000 (09:06 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 2 Jun 2018 18:22:36 +0000 (11:22 -0700)
commitb9308ae696b2c35e862636eec631d95ff958c33d
treee6ec045510d123dbb9f6e1502e4c5aa809e88f6e
parentb4b21a05b8fe7288087691e993c913a41fd6eb4b
bpf: btf: Check array t->size

This patch ensures array's t->size is 0.

The array size is decided by its individual elem's size and the
number of elements.  Hence, t->size is not used and
it must be 0.

A test case is added to test_btf.c

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/btf.c
tools/testing/selftests/bpf/test_btf.c