public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"shuwang@redhat.com" <shuwang@redhat.com>,
	"kashyap.desai@broadcom.com" <kashyap.desai@broadcom.com>,
	"shivasharan.srikanteshwara@broadcom.com" 
	<shivasharan.srikanteshwara@broadcom.com>,
	"sumit.saxena@broadcom.com" <sumit.saxena@broadcom.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"liwang@redhat.com" <liwang@redhat.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"chuhu@redhat.com" <chuhu@redhat.com>,
	"megaraidlinux.pdl@broadcom.com" <megaraidlinux.pdl@broadcom.com>
Subject: Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion
Date: Thu, 14 Sep 2017 12:47:10 +0000	[thread overview]
Message-ID: <1505393229.2898.3.camel@wdc.com> (raw)
In-Reply-To: <20170914061646.10275-1-shuwang@redhat.com>

On Thu, 2017-09-14 at 14:16 +0800, shuwang@redhat.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.

  reply	other threads:[~2017-09-14 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  6:16 [PATCH] megaraid: kmemleak: Track page allocation for fusion shuwang
2017-09-14 12:47 ` Bart Van Assche [this message]
2017-09-14 12:51 ` Sumit Saxena
2017-09-14 12:55 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505393229.2898.3.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=catalin.marinas@arm.com \
    --cc=chuhu@redhat.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liwang@redhat.com \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=shuwang@redhat.com \
    --cc=sumit.saxena@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox