From: Greg KH <gregkh@linuxfoundation.org>
To: Sandhya Bankar <bankarsandhya512@gmail.com>
Cc: outreachy-kernel@googlegroups.com, labbott@redhat.com,
sumit.semwal@linaro.org, arve@android.com, riandrews@android.com
Subject: Re: [Outreachy kernel] [PATCH 1/2] Staging: android: Modify argument of sizeof() to pointer variables.
Date: Sat, 17 Sep 2016 20:27:16 +0200 [thread overview]
Message-ID: <20160917182716.GA27686@kroah.com> (raw)
In-Reply-To: <d9306dc12be43f1c65e8a6a780a1fe8f47866bbf.1474055668.git.bankarsandhya512@gmail.com>
On Sat, Sep 17, 2016 at 02:20:59AM +0530, Sandhya Bankar wrote:
> Modify arguments of sizeof() to pointer variables.
> The destination of the allocation has type struct **, so the
> elements of the array should have pointer type, not structure type.
>
> These changes are made using below Coccinelle script:
>
> @disable sizeof_type_expr@
> type T;
> T **x;
> @@
>
> x =
> <+...sizeof(
> - T
> + *x
> )...+>
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> ---
> drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
> index 659aa71..4f0dd4b 100755
> --- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c
> +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
> @@ -57,7 +57,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
> return PTR_ERR(ipdev->data);
>
> ipdev->heaps = devm_kzalloc(&pdev->dev,
> - sizeof(struct ion_heap)*ipdev->data->nr,
> + sizeof(*ipdev->heaps)*ipdev->data->nr,
You just changed the size of the memory you allocated, please always be
_VERY_ careful when making a change like this. The original code is
correct, please leave it as-is.
thanks,
greg k-h
next prev parent reply other threads:[~2016-09-17 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 20:47 [PATCH 0/2] Staging: Modify argument of sizeof() to pointer variables Sandhya Bankar
2016-09-16 20:50 ` [PATCH 1/2] Staging: android: " Sandhya Bankar
2016-09-17 18:27 ` Greg KH [this message]
2016-09-16 20:53 ` [PATCH 2/2] Staging: lustre: " Sandhya Bankar
2016-09-17 8:49 ` [Outreachy kernel] " Julia Lawall
[not found] ` <6B5E7F24-CAC2-49CB-B717-6D64C40CFE82@intel.com>
[not found] ` <alpine.LFD.2.20.1609182113040.31599@casper.infradead.org>
2016-09-19 15:37 ` sandhya bankar
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=20160917182716.GA27686@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=arve@android.com \
--cc=bankarsandhya512@gmail.com \
--cc=labbott@redhat.com \
--cc=outreachy-kernel@googlegroups.com \
--cc=riandrews@android.com \
--cc=sumit.semwal@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.