diff options
Diffstat (limited to 'kernel/bpf/btf.c')
| -rw-r--r-- | kernel/bpf/btf.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 715f9fcf4712..c57bd10340ed 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c | |||
| @@ -467,7 +467,7 @@ static const struct btf_kind_operations *btf_type_ops(const struct btf_type *t) | |||
| 467 | return kind_ops[BTF_INFO_KIND(t->info)]; | 467 | return kind_ops[BTF_INFO_KIND(t->info)]; |
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | bool btf_name_offset_valid(const struct btf *btf, u32 offset) | 470 | static bool btf_name_offset_valid(const struct btf *btf, u32 offset) |
| 471 | { | 471 | { |
| 472 | return BTF_STR_OFFSET_VALID(offset) && | 472 | return BTF_STR_OFFSET_VALID(offset) && |
| 473 | offset < btf->hdr.str_len; | 473 | offset < btf->hdr.str_len; |
| @@ -1219,8 +1219,6 @@ static void btf_bitfield_seq_show(void *data, u8 bits_offset, | |||
| 1219 | u8 nr_copy_bits; | 1219 | u8 nr_copy_bits; |
| 1220 | u64 print_num; | 1220 | u64 print_num; |
| 1221 | 1221 | ||
| 1222 | data += BITS_ROUNDDOWN_BYTES(bits_offset); | ||
| 1223 | bits_offset = BITS_PER_BYTE_MASKED(bits_offset); | ||
| 1224 | nr_copy_bits = nr_bits + bits_offset; | 1222 | nr_copy_bits = nr_bits + bits_offset; |
| 1225 | nr_copy_bytes = BITS_ROUNDUP_BYTES(nr_copy_bits); | 1223 | nr_copy_bytes = BITS_ROUNDUP_BYTES(nr_copy_bits); |
| 1226 | 1224 | ||
| @@ -1255,7 +1253,9 @@ static void btf_int_bits_seq_show(const struct btf *btf, | |||
| 1255 | * BTF_INT_OFFSET() cannot exceed 64 bits. | 1253 | * BTF_INT_OFFSET() cannot exceed 64 bits. |
| 1256 | */ | 1254 | */ |
| 1257 | total_bits_offset = bits_offset + BTF_INT_OFFSET(int_data); | 1255 | total_bits_offset = bits_offset + BTF_INT_OFFSET(int_data); |
| 1258 | btf_bitfield_seq_show(data, total_bits_offset, nr_bits, m); | 1256 | data += BITS_ROUNDDOWN_BYTES(total_bits_offset); |
| 1257 | bits_offset = BITS_PER_BYTE_MASKED(total_bits_offset); | ||
| 1258 | btf_bitfield_seq_show(data, bits_offset, nr_bits, m); | ||
| 1259 | } | 1259 | } |
| 1260 | 1260 | ||
| 1261 | static void btf_int_seq_show(const struct btf *btf, const struct btf_type *t, | 1261 | static void btf_int_seq_show(const struct btf *btf, const struct btf_type *t, |
| @@ -1459,7 +1459,8 @@ static int btf_modifier_resolve(struct btf_verifier_env *env, | |||
| 1459 | 1459 | ||
| 1460 | /* "typedef void new_void", "const void"...etc */ | 1460 | /* "typedef void new_void", "const void"...etc */ |
| 1461 | if (!btf_type_is_void(next_type) && | 1461 | if (!btf_type_is_void(next_type) && |
| 1462 | !btf_type_is_fwd(next_type)) { | 1462 | !btf_type_is_fwd(next_type) && |
| 1463 | !btf_type_is_func_proto(next_type)) { | ||
| 1463 | btf_verifier_log_type(env, v->t, "Invalid type_id"); | 1464 | btf_verifier_log_type(env, v->t, "Invalid type_id"); |
| 1464 | return -EINVAL; | 1465 | return -EINVAL; |
| 1465 | } | 1466 | } |
| @@ -2001,12 +2002,12 @@ static void btf_struct_seq_show(const struct btf *btf, const struct btf_type *t, | |||
| 2001 | 2002 | ||
| 2002 | member_offset = btf_member_bit_offset(t, member); | 2003 | member_offset = btf_member_bit_offset(t, member); |
| 2003 | bitfield_size = btf_member_bitfield_size(t, member); | 2004 | bitfield_size = btf_member_bitfield_size(t, member); |
| 2005 | bytes_offset = BITS_ROUNDDOWN_BYTES(member_offset); | ||
| 2006 | bits8_offset = BITS_PER_BYTE_MASKED(member_offset); | ||
| 2004 | if (bitfield_size) { | 2007 | if (bitfield_size) { |
| 2005 | btf_bitfield_seq_show(data, member_offset, | 2008 | btf_bitfield_seq_show(data + bytes_offset, bits8_offset, |
| 2006 | bitfield_size, m); | 2009 | bitfield_size, m); |
| 2007 | } else { | 2010 | } else { |
| 2008 | bytes_offset = BITS_ROUNDDOWN_BYTES(member_offset); | ||
| 2009 | bits8_offset = BITS_PER_BYTE_MASKED(member_offset); | ||
| 2010 | ops = btf_type_ops(member_type); | 2011 | ops = btf_type_ops(member_type); |
| 2011 | ops->seq_show(btf, member_type, member->type, | 2012 | ops->seq_show(btf, member_type, member->type, |
| 2012 | data + bytes_offset, bits8_offset, m); | 2013 | data + bytes_offset, bits8_offset, m); |
