public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/pmu: fix noderef.cocci warnings
       [not found] <201801122113.PamSF4io%fengguang.wu@intel.com>
@ 2018-01-12 13:31 ` kbuild test robot
  2018-01-12 14:28   ` [Intel-gfx] " Tvrtko Ursulin
  2018-01-12 14:33   ` Ville Syrjälä
  0 siblings, 2 replies; 3+ messages in thread
From: kbuild test robot @ 2018-01-12 13:31 UTC (permalink / raw)
  To: Tvrtko Ursulin
  Cc: kbuild-all, Chris Wilson, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, David Airlie, intel-gfx, dri-devel, linux-kernel

From: Fengguang Wu <fengguang.wu@intel.com>

drivers/gpu/drm/i915/i915_pmu.c:795:34-40: ERROR: application of sizeof to pointer

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 i915_pmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -792,7 +792,7 @@ create_event_attributes(struct drm_i915_
 		goto err_alloc;
 
 	/* Max one pointer of each attribute type plus a termination entry. */
-	attr = kzalloc((count * 2 + 1) * sizeof(attr), GFP_KERNEL);
+	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
 	if (!attr)
 		goto err_alloc;
 

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

* Re: [Intel-gfx] [PATCH] drm/i915/pmu: fix noderef.cocci warnings
  2018-01-12 13:31 ` [PATCH] drm/i915/pmu: fix noderef.cocci warnings kbuild test robot
@ 2018-01-12 14:28   ` Tvrtko Ursulin
  2018-01-12 14:33   ` Ville Syrjälä
  1 sibling, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2018-01-12 14:28 UTC (permalink / raw)
  To: kbuild test robot, Tvrtko Ursulin
  Cc: dri-devel, David Airlie, intel-gfx, linux-kernel, kbuild-all,
	Rodrigo Vivi


On 12/01/2018 13:31, kbuild test robot wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
> 
> drivers/gpu/drm/i915/i915_pmu.c:795:34-40: ERROR: application of sizeof to pointer
> 
>   sizeof when applied to a pointer typed expression gives the size of
>   the pointer
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>   i915_pmu.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -792,7 +792,7 @@ create_event_attributes(struct drm_i915_
>   		goto err_alloc;
>   
>   	/* Max one pointer of each attribute type plus a termination entry. */
> -	attr = kzalloc((count * 2 + 1) * sizeof(attr), GFP_KERNEL);
> +	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);
>   	if (!attr)
>   		goto err_alloc;
>   

Luckily it is the same size so no actual bug, but fix is still valid. 
Will merge it once it passes CI, thanks!

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

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

* Re: [PATCH] drm/i915/pmu: fix noderef.cocci warnings
  2018-01-12 13:31 ` [PATCH] drm/i915/pmu: fix noderef.cocci warnings kbuild test robot
  2018-01-12 14:28   ` [Intel-gfx] " Tvrtko Ursulin
@ 2018-01-12 14:33   ` Ville Syrjälä
  1 sibling, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2018-01-12 14:33 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Tvrtko Ursulin, dri-devel, David Airlie, intel-gfx,
	Joonas Lahtinen, linux-kernel, kbuild-all, Rodrigo Vivi

On Fri, Jan 12, 2018 at 09:31:16PM +0800, kbuild test robot wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
> 
> drivers/gpu/drm/i915/i915_pmu.c:795:34-40: ERROR: application of sizeof to pointer
> 
>  sizeof when applied to a pointer typed expression gives the size of
>  the pointer
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  i915_pmu.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -792,7 +792,7 @@ create_event_attributes(struct drm_i915_
>  		goto err_alloc;
>  
>  	/* Max one pointer of each attribute type plus a termination entry. */
> -	attr = kzalloc((count * 2 + 1) * sizeof(attr), GFP_KERNEL);
> +	attr = kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL);

kcalloc()?

>  	if (!attr)
>  		goto err_alloc;
>  
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

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

end of thread, other threads:[~2018-01-12 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201801122113.PamSF4io%fengguang.wu@intel.com>
2018-01-12 13:31 ` [PATCH] drm/i915/pmu: fix noderef.cocci warnings kbuild test robot
2018-01-12 14:28   ` [Intel-gfx] " Tvrtko Ursulin
2018-01-12 14:33   ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox