smatch_type: never refer to ->bit_size directly
I'm going to change how smatch handles sizeof() and it it ends up meaning
that sometimes we encounter type symbols which haven't been evaluated yet.
This means we sometimes need to call examine_symbol_type() before looking
looking at ->bit_size. This should happen in one place which is
type_bits(). So always call type_bits() instead of looking at
sym->bit_size.
It turns out as well that most times we want the size in bytes instead of
bits. I have introduced type_bytes() for this.
check_stack.c was checking the size of the stack usage but everything was
stored in bits instead of bytes and that doesn't make sense. I have
changed everything to use bytes here.
In smatch_buf_size.c it was checking for -1 bytes but never worked. We can
have -1 bits but -1 / 8 is zero. type_bytes() never returns negatives.
check_kmalloc_wrong_size.c had the same issue.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
13 files changed: