intel/decoder: Fix is_header_field starting condition.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 12 Apr 2017 16:53:44 +0000 (09:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 17 Apr 2017 05:58:23 +0000 (22:58 -0700)
Starting positions >= 32 are not part of the header, rather than >.

Caught by Coverity, which found that "bits <<= field->start" may shift
by 32, which has undefined behavior.

CID: 1404968

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_decoder.c

index 03c9c7f8d46576e95f19d300e66bd97c0616a61a..e3327d38542134eff68910d6998b913fb0ffd969 100644 (file)
@@ -849,7 +849,7 @@ is_header_field(struct gen_group *group, struct gen_field *field)
 {
    uint32_t bits;
 
-   if (field->start > 32)
+   if (field->start >= 32)
       return false;
 
    bits = (1U << (field->end - field->start + 1)) - 1;