[igt-dev] [PATCH i-g-t v3] lib/igt_kms: Fixed the usage of dereferencing of null pointer

Mohammed Thasleem mohammed.thasleem at intel.com
Fri Jan 20 13:35:40 UTC 2023


Fixed the usage of dereferencing of null pointer to avoid crash.

v2: Removed igt_require and return false if proplist empty. (Kamil)

v3: Corrected commit msg and description. (Kamil)

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 lib/igt_kms.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b4a98ae1..6a0c5ac2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1941,6 +1941,9 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 	int i;
 
 	proplist = drmModeObjectGetProperties(drm_fd, object_id, object_type);
+	if (!proplist)
+		return false;
+
 	for (i = 0; i < proplist->count_props; i++) {
 		_prop = drmModeGetProperty(drm_fd, proplist->props[i]);
 		if (!_prop)
-- 
2.25.1



More information about the igt-dev mailing list