[Mesa-dev] [PATCH] i965: Add missing types to type_sz().

Francisco Jerez currojerez at riseup.net
Thu Jun 2 05:33:42 UTC 2016


Matt Turner <mattst88 at gmail.com> writes:

> Coverity warns in multiple places about the potential for division by
> zero, caused by this function's default case.
>
> Cc: Francisco Jerez <currojerez at riseup.net>

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  src/mesa/drivers/dri/i965/brw_reg.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
> index b0ef94e..be23678 100644
> --- a/src/mesa/drivers/dri/i965/brw_reg.h
> +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> @@ -292,15 +292,19 @@ type_sz(unsigned type)
>     case BRW_REGISTER_TYPE_UD:
>     case BRW_REGISTER_TYPE_D:
>     case BRW_REGISTER_TYPE_F:
> +   case BRW_REGISTER_TYPE_VF:
>        return 4;
>     case BRW_REGISTER_TYPE_UW:
>     case BRW_REGISTER_TYPE_W:
> +   case BRW_REGISTER_TYPE_UV:
> +   case BRW_REGISTER_TYPE_V:
> +   case BRW_REGISTER_TYPE_HF:
>        return 2;
>     case BRW_REGISTER_TYPE_UB:
>     case BRW_REGISTER_TYPE_B:
>        return 1;
>     default:
> -      return 0;
> +      unreachable("not reached");
>     }
>  }
>  
> -- 
> 2.7.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160601/9f915064/attachment.sig>


More information about the mesa-dev mailing list