[Piglit] [PATCH v2] cl: Guard against CL version overflow.

Jan Vesely jan.vesely at rutgers.edu
Tue Jul 25 00:43:16 UTC 2017


On Tue, 2017-07-25 at 00:09 +0000, Vinson Lee wrote:
> Fix Coverity overflowed return value defect.
> 
> CID: 1364163
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>

although it relies on signed overflow wraparound. if it cleans up
coverity output
Acked-by: Jan Vesely <jan.vesely at rutgers.edu>

Jan

> ---
>  tests/util/piglit-framework-cl.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/piglit-framework-cl.c b/tests/util/piglit-framework-cl.c
> index 235f160877cf..758508ff902f 100644
> --- a/tests/util/piglit-framework-cl.c
> +++ b/tests/util/piglit-framework-cl.c
> @@ -450,6 +450,7 @@ piglit_cl_get_version_arg(int argc, const char** argv)
>  {
>  	int version_major = 0;
>  	int version_minor = 0;
> +	int version = 0;
>  
>  	const char* version_str;
>  
> @@ -466,7 +467,9 @@ piglit_cl_get_version_arg(int argc, const char** argv)
>  		}
>  	}
>  
> -	return version_major*10 + version_minor;
> +	version = version_major*10 + version_minor;
> +	assert(version > 0);
> +	return version;
>  }
>  
>  bool
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170724/68b077fc/attachment.sig>


More information about the Piglit mailing list