Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1732258
| From | Bart Van Assche <Bart.VanAssche@wdc.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion |
| Date | 2017-09-14 14:50 +0200 |
| Message-ID | <upBKG-55T-15@gated-at.bofh.it> (permalink) |
| References | <upvFf-1oE-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] megaraid: kmemleak: Track page allocation for fusion shuwang@redhat.com - 2017-09-14 08:20 +0200 Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion Bart Van Assche <Bart.VanAssche@wdc.com> - 2017-09-14 14:50 +0200 Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion Catalin Marinas <catalin.marinas@arm.com> - 2017-09-14 15:00 +0200 RE: [PATCH] megaraid: kmemleak: Track page allocation for fusion Sumit Saxena <sumit.saxena@broadcom.com> - 2017-09-14 15:00 +0200
csiph-web