[igt-dev] [PATCH i-g-t 1/2] runner: Check for strchr result in parse_dmesg_line

Petri Latvala petri.latvala at intel.com
Thu Aug 11 05:12:59 UTC 2022


On Wed, Aug 10, 2022 at 03:44:52PM +0200, Ryszard Knop wrote:
> The intent here most likely was that if strchr returns NULL, the error
> below is printed out, but the condition was to check if the provided
> buffer was not NULL.
> 
> Signed-off-by: Ryszard Knop <ryszard.knop at intel.com>

Yes.

Reviewed-by: Petri Latvala <petri.latvala at intel.com>

> ---
>  runner/resultgen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index 6ecf325b..38d90bda 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -864,7 +864,7 @@ static bool parse_dmesg_line(char* line,
>  	}
>  
>  	*message = strchr(line, ';');
> -	if (!message) {
> +	if (*message == NULL) {
>  		fprintf(stderr, "No ; found in kmsg record, this shouldn't happen\n");
>  		return false;
>  	}
> -- 
> 2.37.1
> 


More information about the igt-dev mailing list