Re: [PATCH 2.6.17-rc6 1/9] Base support for kmemleak

From: Catalin Marinas
Date: Tue Jun 13 2006 - 08:46:58 EST


On 13/06/06, Pekka Enberg <penberg@xxxxxxxxxxxxxx> wrote:
On 6/11/06, Catalin Marinas <catalin.marinas@xxxxxxxxx> wrote:
> --- /dev/null
> +++ b/include/linux/memleak.h
> @@ -0,0 +1,83 @@
> +extern void memleak_scan_area(const void *ptr, unsigned long offset, size_t length);
> +extern void memleak_insert_aliases(struct memleak_offset *ml_off_start,
> + struct memleak_offset *ml_off_end);
> +
> +#define memleak_erase(ptr) do { (ptr) = NULL; } while (0)

Use static inline functions instead of macros, please.

That was the simplest way in some cases when kmemleak was not
dependent on DEBUG_SLAB obj_size() in mm/slab.c was not always
defined. It works correctly with inlining now so I'll change them.

> +#define memleak_container(type, member)

This cannot be an inline function as it takes a type as argument.

> +static int __initdata preinit_pos = 0;

Unnecessary initialization to zero.

> +static struct memleak_pointer *last_pointer = NULL;

Same here for NULL.

True, it is unnecessary. That's just my style of marking them as initialised.

> +static int insert_alias(unsigned long size, unsigned long offset)
> +{
> + int ret = 0;

Unnecessary initialization to zero.

That's needed because there is an exit path which doesn't set this variable.

I am OK with the other comments. Thanks.

--
Catalin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/