[PATCH i-g-t] lib: Make sure we don't use a negative offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As bytes_read can contain an error condition under some circumstances,
in which we want to error out.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
---
 lib/igt_debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index d828687a62ca..b1b67e740041 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -601,6 +601,7 @@ static int read_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out)
 		igt_assert(pipe_crc->flags & O_NONBLOCK);
 		bytes_read = 0;
 	}
+	igt_assert_lte(0, bytes_read);
 	buf[bytes_read] = '\0';
 
 	if (bytes_read && !pipe_crc_init_from_string(pipe_crc, out, buf))
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux