When I compile the following previously working code with 23a11c89beddc2fddf8048eba4814d45b4c8c348 applied I get warning which is an error in CheriBSD.
struct malloc_type;
void *kmalloc(unsigned long size, struct malloc_type *type, int flags);
void * __capability
malloc_c(unsigned long size, struct malloc_type *type, int flags)
{
return ((__cheri_tocap void * __capability)kmalloc(size, type, flags));
}
$clang -target cheri-unknown-freebsd -march=mips4 -mabi=64 -mcpu=mips4 -cheri=128 -c -o /dev/null foo.c
foo.c:8:25: warning: cast from provenance-free integer type to pointer type will
give pointer that can not be dereferenced. [-Wcheri-capability-misuse]
return ((__cheri_tocap void * __capability)kmalloc(size, type, flags));
^
foo.c:8:25: note: insert cast to intptr_t to silence this warning
1 warning generated.
When I compile the following previously working code with 23a11c89beddc2fddf8048eba4814d45b4c8c348 applied I get warning which is an error in CheriBSD.