[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1505393229.2898.3.camel@wdc.com>
Date: Thu, 14 Sep 2017 12:47:10 +0000
From: Bart Van Assche <Bart.VanAssche@....com>
To: "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"shuwang@...hat.com" <shuwang@...hat.com>,
"kashyap.desai@...adcom.com" <kashyap.desai@...adcom.com>,
"shivasharan.srikanteshwara@...adcom.com"
<shivasharan.srikanteshwara@...adcom.com>,
"sumit.saxena@...adcom.com" <sumit.saxena@...adcom.com>
CC: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"liwang@...hat.com" <liwang@...hat.com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"chuhu@...hat.com" <chuhu@...hat.com>,
"megaraidlinux.pdl@...adcom.com" <megaraidlinux.pdl@...adcom.com>
Subject: Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion
On Thu, 2017-09-14 at 14:16 +0800, shuwang@...hat.com wrote:
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 11bd2e698b84..621299edd8de 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -48,6 +48,7 @@
> #include <linux/mutex.h>
> #include <linux/poll.h>
> #include <linux/vmalloc.h>
> +#include <linux/kmemleak.h>
>
> #include <scsi/scsi.h>
> #include <scsi/scsi_cmnd.h>
> @@ -4512,7 +4513,9 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)
> dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__);
> return -ENOMEM;
> }
> - }
> + } else
> + kmemleak_alloc(instance->ctrl_context,
> + sizeof(struct fusion_context), 1, GFP_KERNEL);
>
> fusion = instance->ctrl_context;
Thank you for having tracked this down and for having shared this patch. But
please keep braces balanced to keep checkpatch happy and please also consider
adding a comment similar to the following above the kmemleak_alloc() call:
/* Allow kmemleak to scan these pages as they contain pointers to additional allocations. */
> @@ -4548,9 +4551,11 @@ megasas_free_fusion_context(struct megasas_instance *instance)
>
> if (is_vmalloc_addr(fusion))
> vfree(fusion);
> - else
> + else {
> free_pages((ulong)fusion,
> instance->ctrl_context_pages);
> + kmemleak_free(fusion);
> + }
> }
Please keep braces balanced in the above code too.
Thanks,
Bart.
Powered by blists - more mailing lists