All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform")
@ 2016-09-23 15:42 sayli karnik
  2016-09-23 15:57 ` Greg Kroah-Hartman
  2016-09-23 15:59 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 2 replies; 3+ messages in thread
From: sayli karnik @ 2016-09-23 15:42 UTC (permalink / raw)
  To: outreachy-kernel
  Cc: Laura Abbott, Sumit Semwal, Greg Kroah-Hartman,
	Arve Hjønnevåg, Riley Andrews

The sizeof function must take pointer to the ion_heap structure as an argument
when allocating memory for ipdev->heaps. This patch changes the sizeof
argument from (struct ion_heap) to (struct ion_heap *) which is a pointer to
the structure.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
v2:
Fixed the error due to a previous commit
Updated the subject line

 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
index 659aa71..f9a64e7 100644
--- 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(struct ion_heap *) * ipdev->data->nr,
 				GFP_KERNEL);
 	if (!ipdev->heaps) {
 		ion_destroy_platform_data(ipdev->data);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform")
  2016-09-23 15:42 [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform") sayli karnik
@ 2016-09-23 15:57 ` Greg Kroah-Hartman
  2016-09-23 15:59 ` [Outreachy kernel] " Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-23 15:57 UTC (permalink / raw)
  To: sayli karnik
  Cc: outreachy-kernel, Laura Abbott, Sumit Semwal,
	Arve Hjønnevåg, Riley Andrews

On Fri, Sep 23, 2016 at 09:12:21PM +0530, sayli karnik wrote:
> The sizeof function must take pointer to the ion_heap structure as an argument
> when allocating memory for ipdev->heaps. This patch changes the sizeof
> argument from (struct ion_heap) to (struct ion_heap *) which is a pointer to
> the structure.
> 
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>

The "fixes:" line needs to be above the signed-off-by: line, not in the
subject of the patch.  Look at commits in the kernel tree for lots of
examples of how to format this.

third time's a charm?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform")
  2016-09-23 15:42 [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform") sayli karnik
  2016-09-23 15:57 ` Greg Kroah-Hartman
@ 2016-09-23 15:59 ` Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2016-09-23 15:59 UTC (permalink / raw)
  To: sayli karnik
  Cc: outreachy-kernel, Laura Abbott, Sumit Semwal, Greg Kroah-Hartman,
	Arve Hjønnevåg, Riley Andrews



On Fri, 23 Sep 2016, sayli karnik wrote:

> The sizeof function must take pointer to the ion_heap structure as an argument
> when allocating memory for ipdev->heaps. This patch changes the sizeof
> argument from (struct ion_heap) to (struct ion_heap *) which is a pointer to
> the structure.

The sentence "The sizeof function must take pointer to the ion_heap
structure as an argument..." is not very clear.  Why must it do that?  And
actually, here sizeof is taking a type as an argument, not a pointer to a
structure, so the terminology is not quite right.

Basically, the issue is do you want a pointer to a structure, or a pointer
to an array of pointers.  You have made the latter choice.  You need to
look at how the array is used to identify why it is the correct choice.

Hint: it may be helpful to look at other files that use such values in the
same way.

Hint 2: There is at least one other bug lurking nearby, and the other file
that contains code similar to this one has a nearby bug too, although not
exactly the same one.

julia

>
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
> v2:
> Fixed the error due to a previous commit
> Updated the subject line
>
>  drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c
> index 659aa71..f9a64e7 100644
> --- 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(struct ion_heap *) * ipdev->data->nr,
>  				GFP_KERNEL);
>  	if (!ipdev->heaps) {
>  		ion_destroy_platform_data(ipdev->data);
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160923154221.GA4993%40sayli-HP-15-Notebook-PC.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-23 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 15:42 [PATCH v2] Fixes: b6e336dbeda8 ("staging: android: ion: Convert hi6220 to common platform") sayli karnik
2016-09-23 15:57 ` Greg Kroah-Hartman
2016-09-23 15:59 ` [Outreachy kernel] " Julia Lawall

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.