[PATCH i-g-t v7 42/48] lib/igt_kms: Add asserts to avoid null pointer dereference

Louis Chauvet
2026-02-23T12:09:37Z

To help debugging and avoid null pointer dereference, add some asserts in
igt_output_from_connector.

Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
lib/igt_kms.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5eb94be49494..0c61ac6e2788 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3296,6 +3296,8 @@ igt_output_t *igt_output_from_connector(igt_display_t *display,
{
int i;
igt_output_t *found = NULL;
+ igt_assert(display);
+ igt_assert(connector);

for (i = 0; i < display->n_outputs; i++) {
igt_output_t *output = &display->outputs[i];

--
2.52.0