Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
3
-
9223372036854775807
Description
There's some weirdness with the OBD_FREE family of macros, and at least one bug.
First item is more of a style thing, but:
free(), vfree(), and kfree() all accept null pointers without complaint. This simplifies code in exit paths in many places.
The OBD_FREE macros do in their default version, and this behavior is used (inconsistently), but if OBD_DEBUG_MEMUSAGE is on, they do not, because OBD_FREE_PRE asserts the pointer is not null.
We should fix that in OBD_DEBUG_MEMUSAGE;
Then, next:
There are several bugs with POISON_PTR.
If OBD_DEBUG_MEMUSAGE is on:
OBD_FREE poisons the PTR twice.
if CONFIG_DEBUG_SLAB is on, POISON_PTR is enabled...
And we call it after freeing the pointer in several places:
#define OBD_FREE(ptr, size) \
do { \
OBD_FREE_PRE(ptr, size, "kfreed"); \
kfree(ptr); \
POISON_PTR(ptr); \
} while (0)
#define OBD_FREE_LARGE(ptr, size) \
do { \
if (is_vmalloc_addr(ptr))
else {
Yuck! I'll see about doing patches for this at some point.