drm/i915/pmu: fix sizeof on attr, should be *attr
Subsystems (3)
PATCH 1/1 drm/i915/pmu: fix sizeof on attr, should be *attr
From: Colin Ian King <[email protected]>
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")
--- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_pmu.c +1 -1
@@ -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;
Signature · 6 lines
2.15.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 5 lines · Colin King
From: Colin Ian King <[email protected]>
I believe the sizeof(attr) should be in fact
sizeof(*attr), fortunately the current code works becausesizeof(struct attribute **)is the same assizeof(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
Quoted 15 lines
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 <[email protected]>--- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_pmu.c +0
-0
drivers/gpu/drm/i915/i915_pmu.c create_event_attributes(struct drm_i915_private *i915) · line 800
Quoted 8 lines
drivers/gpu/drm/i915/i915_pmu.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/pmu: fix sizeof on attr, should be *attr
In reply to Colin King== Series Details ==
== 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 +1fdo#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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Tvrtko Ursulin
Hi,
Quoted 2 lines · Colin King
From: Colin Ian King <[email protected]>
Quoted 8 lines
Quoted 3 lines
I believe the sizeof(attr) should be in fact
sizeof(*attr), fortunately the current code works becausesizeof(struct attribute **)is the same assizeof(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.
Quoted 15 lines
Regards,
Tvrtko
Quoted 10 lines
Detected by CoverityScan, CID#1463854 ("Sizeof not portable")
Fixes 109ec558370f ("drm/i915/pmu: Only enumerate available countersin sysfs")
Signed-off-by Colin Ian King <[email protected]>---
drivers/gpu/drm/i915/i915_pmu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 9 lines
drivers/gpu/drm/i915/i915_pmu.c +0
-0@@ -794,7 +794,7 @@ create_event_attributes(struct drm_i915_private *i915) goto err_alloc; /* Max one pointer of each attribute type plus a terminationQuoted 6 lines
entry. */
- attr =kzalloc((count * 2 + 1) * sizeof(attr), GFP_KERNEL); + attr =kzalloc((count * 2 + 1) * sizeof(*attr), GFP_KERNEL); if (!attr)
gotoerr_alloc;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: failure for drm/i915/pmu: fix sizeof on attr, should be *attr
In reply to Colin King== Series Details ==
== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx