[igt-dev] [PATCH i-g-t 3/5] lib/debugfs: Ensure null-termination in igt_hpd_storm_detected
Chris Wilson
chris at chris-wilson.co.uk
Thu Mar 7 12:11:18 UTC 2019
Quoting Petri Latvala (2019-03-07 11:24:25)
> Read sizeof - 1 to buf so it stays null-terminated.
>
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> ---
> lib/igt_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 640c78e9..b0e5cfa5 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -628,7 +628,7 @@ bool igt_hpd_storm_detected(int drm_fd)
> if (fd < 0)
> return false;
>
> - igt_assert_lt(0, read(fd, buf, sizeof(buf)));
> + igt_assert_lt(0, read(fd, buf, sizeof(buf) - 1));
> igt_assert(start_loc = strstr(buf, "Detected: "));
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the igt-dev
mailing list