Skip to contentSkip to conversation

lib/igt_kms: Fix build warning in igt_display_drop_events

PATCH In review Tvrtko Ursulin 3 participants 4 messages Jan 9, 2018 – Jan 10, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_kms: Fix build warning in igt_display_drop_events

From: Tvrtko Ursulin <[email protected]>

Check read(2) return for robustness and to silence gcc.

Cc Maarten Lankhorst <[email protected]>

--
Compile tested only.

---
 lib/igt_kms.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/igt_kms.c +3 -2
index ec3b716791a2..c8f30d2c8a54 100644
@@ -3155,10 +3155,11 @@ int igt_display_drop_events(igt_display_t *display)
 		struct drm_event ev;
 		char buf[128];
 
-		read(display->drm_fd, &ev, sizeof(ev));
+		igt_assert_eq(read(display->drm_fd, &ev, sizeof(ev)),
+			      sizeof(ev));
 		igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
 		igt_assert(ev.length <= sizeof(buf));
-		read(display->drm_fd, buf, ev.length);
+		igt_assert_eq(read(display->drm_fd, buf, ev.length), ev.length);
 		ret++;
 	}
 
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for lib/igt_kms: Fix build warning in igt_display_drop_events

== Series Details ==

== Series Details ==

Series: lib/igt_kms: Fix build warning in igt_display_drop_events
URL : https://patchwork.freedesktop.org/series/36190/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 834321a5d76a16783000441a02d7e79e72be9cc9 tools: Cannonlake port clock programming

with latest DRM-Tip kernel build CI_DRM_3612
9213555074f6 drm-tip: 2018y-01m-09d-12h-52m-52s UTC integration manifest

No testlist changes.

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test gem_ringfill:
        Subgroup basic-default:
                skip       -> PASS       (fi-bsw-n3050)
Test kms_chamelium:
        Subgroup hdmi-hpd-fast:
                fail       -> SKIP       (fi-kbl-7500u) fdo#102672
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#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
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:433s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:374s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:496s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
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:491s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:477s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
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:277s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:513s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:407s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:413s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:415s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:467s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:499s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:453s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:507s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:578s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:508s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:530s
fi-skl-6700k2    total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:498s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:434s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:529s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:406s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:576s
fi-cnl-y2        total:288  pass:258  dwarn:3   dfail:0   fail:0   skip:27  time:545s
fi-glk-dsi       total:106  pass:93   dwarn:0   dfail:0   fail:0   skip:12 

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_757/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✗ Fi.CI.IGT: failure for lib/igt_kms: Fix build warning in igt_display_drop_events

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: lib/igt_kms: Fix build warning in igt_display_drop_events
URL : https://patchwork.freedesktop.org/series/36190/
State : failure

== Summary ==

Test kms_cursor_crc:

        Subgroup cursor-64x64-suspend:
                pass       -> SKIP       (shard-hsw) fdo#103540
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                fail       -> PASS       (shard-snb) fdo#101623 +2
Test kms_flip:
        Subgroup vblank-vs-suspend:
                pass       -> FAIL       (shard-snb) fdo#102365
        Subgroup plain-flip-fb-recreate-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test gem_pwrite:
        Subgroup huge-cpu-forwards:
                pass       -> INCOMPLETE (shard-snb)
Test drv_suspend:
        Subgroup fence-restore-tiled2untiled:
                skip       -> PASS       (shard-snb) fdo#104218
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> FAIL       (shard-hsw) fdo#103375

fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375

shard-hsw        total:2713 pass:1535 dwarn:1   dfail:0   fail:12  skip:1165 time:9107s
shard-snb        total:2703 pass:1305 dwarn:1   dfail:0   fail:11  skip:1385 time:7703s
Blacklisted hosts:
shard-apl        total:2713 pass:1684 dwarn:1   dfail:0   fail:26  skip:1001 time:13685s
shard-kbl        total:2713 pass:1794 dwarn:10  dfail:0   fail:31  skip:878 time:10606s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_757/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2018-01-09 12:47:04)

Quoted 6 lines

From: Tvrtko Ursulin <[email protected]>

Check read(2) return for robustness and to silence gcc.

Cc Maarten Lankhorst <[email protected]>

Hmm, mildly concerned about ev.length. A long time ago when I was last in the event queue, we guaranteed writing whole requests and nothing but whole requests.

Quoted 9 lines
---
 lib/igt_kms.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/igt_kms.c +0 -0
index ec3b716791a2..c8f30d2c8a54 100644

lib/igt_kms.c int igt_display_drop_events(igt_display_t *display) · line 3162

Quoted 10 lines
lib/igt_kms.c +3 -2
@@ -3155,10 +3155,11 @@ int igt_display_drop_events(igt_display_t *display)
                struct drm_event ev;
                char buf[128];
 
-               read(display->drm_fd, &ev, sizeof(ev));
+               igt_assert_eq(read(display->drm_fd, &ev, sizeof(ev)),
+                             sizeof(ev));
                igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
                igt_assert(ev.length <= sizeof(buf));
-               read(display->drm_fd, buf, ev.length);
+               igt_assert_eq(read(display->drm_fd, buf, ev.length), ev.length);

What we do in drm_read() is

	copy_to_user(buffer, e->event, e->event->length)

so this read here is too long (as its sizeof(event) + event.length). The assert will one day blow up... But only because the code is incorrect. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx