Re: [PATCH] mm: kmemleak: Remove security and coding style warning

From: Catalin Marinas
Date: Sat Nov 11 2023 - 07:42:51 EST


On Fri, Nov 10, 2023 at 11:11:02AM -0800, Omkar Wagle wrote:
> @@ -368,6 +367,7 @@ static void print_unreferenced(struct seq_file *seq,
>
> for (i = 0; i < nr_entries; i++) {
> void *ptr = (void *)entries[i];
> +
> warn_or_seq_printf(seq, " [<%pK>] %pS\n", ptr, ptr);
> }
> }
> @@ -406,10 +406,11 @@ static struct kmemleak_object *__lookup_object(unsigned long ptr, int alias,
> unsigned long untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr);
>
> while (rb) {
> - struct kmemleak_object *object;
> + struct kmemleak_object *object = NULL;

Seriously, what's this initialisation for?

> unsigned long untagged_objp;
>
> object = rb_entry(rb, struct kmemleak_object, rb_node);

The variable gets assigned here.

> +
> untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer);

I'm also not a fan of random whitespace updates throughout this file. It
makes backporting fixes harder later on.

--
Catalin