basic: make check-pointer-deref clean

Add the needed assert changes to make the code clean
for the new check-pointer-deref script.

Note that for `_cmp()` functions its a bit of a question
if we want `assert()` or `POINTER_MAY_BE_NULL()` here. The
former is more correct but it adds a (small) runtime hit. If
we use POINTER_MAY_BE_NULL() it is compiled out but strictly
speaking it is wrong (so at least we would need a comment).
This commit is contained in:
Michael Vogt
2026-03-31 18:30:40 +02:00
parent 1692d51eb2
commit 18e70eec2f
30 changed files with 146 additions and 3 deletions
+10
View File
@@ -103,10 +103,15 @@ DEFINE_HASH_OPS_FULL(
void, free);
void uint64_hash_func(const uint64_t *p, struct siphash *state) {
assert(p);
siphash24_compress_typesafe(*p, state);
}
int uint64_compare_func(const uint64_t *a, const uint64_t *b) {
assert(a);
assert(b);
return CMP(*a, *b);
}
@@ -119,6 +124,8 @@ DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
#if SIZEOF_DEV_T != 8
void devt_hash_func(const dev_t *p, struct siphash *state) {
assert(p);
siphash24_compress_typesafe(*p, state);
}
#endif
@@ -126,6 +133,9 @@ void devt_hash_func(const dev_t *p, struct siphash *state) {
int devt_compare_func(const dev_t *a, const dev_t *b) {
int r;
assert(a);
assert(b);
r = CMP(major(*a), major(*b));
if (r != 0)
return r;