obj/btf: Fix size of Unknown variant

The size of Unknown should be ty_size, otherwise when it is encountered,
we never advance the cursor and it creates an infinite loop.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/53/head
Dave Tucker 3 years ago committed by Alessandro Decina
parent 569b8ca39e
commit 4e1ce2534c

@ -154,7 +154,7 @@ impl BtfType {
use BtfType::*; use BtfType::*;
match self { match self {
Unknown => 0, Unknown => ty_size,
Fwd(_) | Const(_) | Volatile(_) | Restrict(_) | Ptr(_) | Typedef(_) | Func(_) Fwd(_) | Const(_) | Volatile(_) | Restrict(_) | Ptr(_) | Typedef(_) | Func(_)
| Float(_) => ty_size, | Float(_) => ty_size,
Int(_, _) => ty_size + mem::size_of::<u32>(), Int(_, _) => ty_size + mem::size_of::<u32>(),

Loading…
Cancel
Save