From: Gert Wollny Date: Tue, 5 Jun 2018 11:58:47 +0000 (+0200) Subject: gallium/aux/tgsi/tgsi_parse.c: Fix two warnings X-Git-Tag: android-x86-8.1-r1~2854 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bf6b695a90d7f1ee6b1af93301ed91c4fdd8d9af;p=android-x86%2Fexternal-mesa.git gallium/aux/tgsi/tgsi_parse.c: Fix two warnings tgsi_parse.c: In function 'tgsi_parse_free': tgsi_parse.c:54:31: warning: unused parameter 'ctx' [-Wunused-parameter] struct tgsi_parse_context *ctx ) ^~~ tgsi_parse.c: In function 'tgsi_parse_end_of_tokens': tgsi_parse.c:62:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] return ctx->Position >= Signed-off-by: Gert Wollny Reviewed-by: Emil Velikov --- diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index c706fc8ae2e..65f7e74e116 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -51,7 +51,7 @@ tgsi_parse_init( void tgsi_parse_free( - struct tgsi_parse_context *ctx ) + UNUSED struct tgsi_parse_context *ctx ) { } @@ -59,8 +59,12 @@ boolean tgsi_parse_end_of_tokens( struct tgsi_parse_context *ctx ) { - return ctx->Position >= - ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize; + /* All values involved are unsigned, but the sum will be promoted to + * a signed value (at least on 64 bit). To capture a possible overflow + * make it a signed comparison. + */ + return (int)ctx->Position >= + ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize; }