summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2019-01-16 13:20:38 +0200
committerPetri Latvala <petri.latvala@intel.com>2019-01-21 13:51:01 +0200
commit98c59bb3e3c9c6496bf5b7331d84a38bede0b932 (patch)
tree895e4c4b354dd5cd799fa458a32c50f91e79e3f4 /lib/igt_kms.c
parentef6d3a271e18d2282c5be3e9110b6dc80f4a67e5 (diff)
lib/igt_kms: Make igt_display_init require at least one plane
Not only will the following calloc call end up allocating 0 bytes (undefined behaviour), but last_plane becomes (uint8_t)-1. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Robert Foss <robert.foss@collabora.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Robert Foss <robert.foss@collabora.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f926eafb..b06acb2b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1932,7 +1932,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)
drmModeFreePlane(drm_plane);
}
- igt_assert_lte(0, n_planes);
+ igt_assert_lt(0, n_planes);
pipe->planes = calloc(sizeof(igt_plane_t), n_planes);
igt_assert_f(pipe->planes, "Failed to allocate memory for %d planes\n", n_planes);
last_plane = n_planes - 1;