All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
@ 2018-01-12 17:36 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2018-01-12 17:36 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
the current code works because sizeof(struct attribute **) is the same
as sizeof(struct attribute *) for x86.

Detected by CoverityScan, CID#1463854 ("Sizeof not portable")

Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 95ab5e28f5be..9be4f5201e41 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *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;
 
-- 
2.15.1

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

* [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
@ 2018-01-12 17:36 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2018-01-12 17:36 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
the current code works because sizeof(struct attribute **) is the same
as sizeof(struct attribute *) for x86.

Detected by CoverityScan, CID#1463854 ("Sizeof not portable")

Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 95ab5e28f5be..9be4f5201e41 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *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;
 
-- 
2.15.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Intel-gfx] [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
  2018-01-12 17:36 ` Colin King
@ 2018-01-12 17:48   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-01-12 17:48 UTC (permalink / raw)
  To: Colin King, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel


Hi,

On 12/01/2018 17:36, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
> the current code works because sizeof(struct attribute **) is the same
> as sizeof(struct attribute *) for x86.

Thanks, kbuild also reported it and I just pushed a fix.

Out of curiosity, there are platforms where size of pointer is different 
from the size of a pointer to a pointer?

Regards,

Tvrtko

> 
> Detected by CoverityScan, CID#1463854 ("Sizeof not portable")
> 
> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/gpu/drm/i915/i915_pmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 95ab5e28f5be..9be4f5201e41 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *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] 8+ messages in thread

* Re: [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
@ 2018-01-12 17:48   ` Tvrtko Ursulin
  0 siblings, 0 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-01-12 17:48 UTC (permalink / raw)
  To: Colin King, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel


Hi,

On 12/01/2018 17:36, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
> the current code works because sizeof(struct attribute **) is the same
> as sizeof(struct attribute *) for x86.

Thanks, kbuild also reported it and I just pushed a fix.

Out of curiosity, there are platforms where size of pointer is different 
from the size of a pointer to a pointer?

Regards,

Tvrtko

> 
> Detected by CoverityScan, CID#1463854 ("Sizeof not portable")
> 
> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/gpu/drm/i915/i915_pmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 95ab5e28f5be..9be4f5201e41 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *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;
>   
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915/pmu: fix sizeof on attr, should be *attr
  2018-01-12 17:36 ` Colin King
  (?)
  (?)
@ 2018-01-12 17:57 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-01-12 17:57 UTC (permalink / raw)
  To: Colin King; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/pmu: fix sizeof on attr, should be *attr
URL   : https://patchwork.freedesktop.org/series/36423/
State : success

== Summary ==

Series 36423v1 drm/i915/pmu: fix sizeof on attr, should be *attr
https://patchwork.freedesktop.org/api/1.0/series/36423/revisions/1/mbox/

Test debugfs_test:
        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                dmesg-warn -> PASS       (fi-kbl-r) fdo#104172 +1

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:422s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:426s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:372s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:484s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:279s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:487s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:467s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:459s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:273s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:510s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:394s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:402s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:411s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:451s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:416s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:462s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:502s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:457s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:502s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:590s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:435s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:516s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:528s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:496s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:487s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:431s
fi-snb-2520m     total:3    pass:2    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:397s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:467s

353fa2d3affffef324005ed2553da6eb174a2f0b drm-tip: 2018y-01m-12d-09h-21m-50s UTC integration manifest
c151aa46f025 drm/i915/pmu: fix sizeof on attr, should be *attr

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7658/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
  2018-01-12 17:48   ` Tvrtko Ursulin
@ 2018-01-12 18:08     ` Colin Ian King
  -1 siblings, 0 replies; 8+ messages in thread
From: Colin Ian King @ 2018-01-12 18:08 UTC (permalink / raw)
  To: Tvrtko Ursulin, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

On 12/01/18 17:48, Tvrtko Ursulin wrote:
> 
> Hi,
> 
> On 12/01/2018 17:36, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
>> the current code works because sizeof(struct attribute **) is the same
>> as sizeof(struct attribute *) for x86.
> 
> Thanks, kbuild also reported it and I just pushed a fix.
> 
> Out of curiosity, there are platforms where size of pointer is different
> from the size of a pointer to a pointer?

None that I know of.

> 
> Regards,
> 
> Tvrtko
> 
>>
>> Detected by CoverityScan, CID#1463854 ("Sizeof not portable")
>>
>> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters
>> in sysfs")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   drivers/gpu/drm/i915/i915_pmu.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_pmu.c
>> b/drivers/gpu/drm/i915/i915_pmu.c
>> index 95ab5e28f5be..9be4f5201e41 100644
>> --- a/drivers/gpu/drm/i915/i915_pmu.c
>> +++ b/drivers/gpu/drm/i915/i915_pmu.c
>> @@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private
>> *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] 8+ messages in thread

* Re: [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr
@ 2018-01-12 18:08     ` Colin Ian King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin Ian King @ 2018-01-12 18:08 UTC (permalink / raw)
  To: Tvrtko Ursulin, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	David Airlie, intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

On 12/01/18 17:48, Tvrtko Ursulin wrote:
> 
> Hi,
> 
> On 12/01/2018 17:36, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> I believe the sizeof(attr) should be in fact sizeof(*attr), fortunately
>> the current code works because sizeof(struct attribute **) is the same
>> as sizeof(struct attribute *) for x86.
> 
> Thanks, kbuild also reported it and I just pushed a fix.
> 
> Out of curiosity, there are platforms where size of pointer is different
> from the size of a pointer to a pointer?

None that I know of.

> 
> Regards,
> 
> Tvrtko
> 
>>
>> Detected by CoverityScan, CID#1463854 ("Sizeof not portable")
>>
>> Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters
>> in sysfs")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   drivers/gpu/drm/i915/i915_pmu.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_pmu.c
>> b/drivers/gpu/drm/i915/i915_pmu.c
>> index 95ab5e28f5be..9be4f5201e41 100644
>> --- a/drivers/gpu/drm/i915/i915_pmu.c
>> +++ b/drivers/gpu/drm/i915/i915_pmu.c
>> @@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private
>> *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;
>>  

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.IGT: failure for drm/i915/pmu: fix sizeof on attr, should be *attr
  2018-01-12 17:36 ` Colin King
                   ` (2 preceding siblings ...)
  (?)
@ 2018-01-12 19:28 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-01-12 19:28 UTC (permalink / raw)
  To: Colin Ian King; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/pmu: fix sizeof on attr, should be *attr
URL   : https://patchwork.freedesktop.org/series/36423/
State : failure

== Summary ==

Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-hsw) fdo#104218 +1
Test gem_eio:
        Subgroup in-flight-contexts:
                dmesg-warn -> PASS       (shard-snb) fdo#104058 +1
Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-b-planes:
                pass       -> SKIP       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623
        Subgroup fbc-1p-primscrn-pri-indfb-draw-pwrite:
                fail       -> PASS       (shard-snb) fdo#103167
Test kms_flip:
        Subgroup vblank-vs-modeset-suspend:
                pass       -> INCOMPLETE (shard-hsw)
Test gem_wait:
        Subgroup write-busy-bsd:
                skip       -> PASS       (shard-snb)
Test gem_pwrite_snooped:
                fail       -> PASS       (shard-snb) fdo#104600
Test perf_pmu:
        Subgroup busy-check-all-rcs0:
                skip       -> PASS       (shard-snb)
Test gem_exec_parallel:
        Subgroup default-fds:
                skip       -> PASS       (shard-snb)
Test gem_partial_pwrite_pread:
        Subgroup write:
                skip       -> PASS       (shard-snb)
Test prime_vgem:
        Subgroup fence-wait-blt:
                skip       -> PASS       (shard-snb)

fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#104058 https://bugs.freedesktop.org/show_bug.cgi?id=104058
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#104600 https://bugs.freedesktop.org/show_bug.cgi?id=104600

shard-hsw        total:2642 pass:1488 dwarn:1   dfail:0   fail:10  skip:1142 time:8481s
shard-snb        total:2713 pass:1310 dwarn:1   dfail:0   fail:11  skip:1391 time:7870s
Blacklisted hosts:
shard-apl        total:2691 pass:1662 dwarn:1   dfail:0   fail:25  skip:1001 time:13211s
shard-kbl        total:2713 pass:1793 dwarn:20  dfail:0   fail:24  skip:876 time:10674s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7658/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12 17:36 [PATCH][next] drm/i915/pmu: fix sizeof on attr, should be *attr Colin King
2018-01-12 17:36 ` Colin King
2018-01-12 17:48 ` [Intel-gfx] " Tvrtko Ursulin
2018-01-12 17:48   ` Tvrtko Ursulin
2018-01-12 18:08   ` [Intel-gfx] " Colin Ian King
2018-01-12 18:08     ` Colin Ian King
2018-01-12 17:57 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-01-12 19:28 ` ✗ Fi.CI.IGT: failure " Patchwork

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.