lkml.org 
[lkml]   [2023]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] MM: kmemleak: Removed coding style warnings and added a NULL check
On Tue, Nov 07, 2023 at 10:27:56PM -0800, Omkar Wagle wrote:
> @@ -406,10 +406,13 @@ 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;
> unsigned long untagged_objp;
>
> object = rb_entry(rb, struct kmemleak_object, rb_node);
> + if (!object)
> + break;

No need for this. rb_entry() is a container_of() and we already check
that rb is not NULL.

> @@ -1027,7 +1030,7 @@ static void object_no_scan(unsigned long ptr)
> void __ref kmemleak_alloc(const void *ptr, size_t size, int min_count,
> gfp_t gfp)
> {
> - pr_debug("%s(0x%px, %zu, %d)\n", __func__, ptr, size, min_count);
> + pr_debug("%s(0x%p, %zu, %d)\n", __func__, ptr, size, min_count);

That's for debugging, I'd rather keep the %px option. The same comment
applies to all the other pr_debug() changes in this file.

--
Catalin

\
 
 \ /
  Last update: 2023-11-20 13:52    [W:0.056 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site