[igt-dev] [PATCH i-g-t 1/2] lib/igt_eld: fix potential read from undefined value

Peres, Martin martin.peres at intel.com
Tue Jun 18 13:01:49 UTC 2019


On 18/06/2019 15:55, Ser, Simon wrote:
> If the ELD doesn't contain a monitor_present line (this shouldn't happen), then
> the value is garbage. Define the variable as a safety net.
> 
> Signed-off-by: Simon Ser <simon.ser at intel.com>

Reviewed-by: Martin Peres <martin.peres at linux.intel.com>

> ---
>  lib/igt_eld.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> index 15dd8ac95189..3d7fd4dd0a82 100644
> --- a/lib/igt_eld.c
> +++ b/lib/igt_eld.c
> @@ -152,7 +152,7 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
>  	char buf[1024];
>  	char *key, *value, *sad_key;
>  	size_t len;
> -	bool monitor_present;
> +	bool monitor_present = false;
>  	int sad_index;
>  
>  	memset(eld, 0, sizeof(*eld));
> 



More information about the igt-dev mailing list