[Mesa-dev] [PATCH 2/5] gallium: Weaken assertion about u_mm's align2 field.

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 20 15:32:56 UTC 2017


On 19.09.2017 20:06, Eric Anholt wrote:
> vc5 MMU mappings are access-controlled at a 128kb boundary, so the 4kb
> here was too small for that purpose.  Allowing any valid align2 value that
> u_mm's 32-bit addressing can represent will still catch most cases of
> people passing in a byte alignment.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


> ---
>   src/gallium/auxiliary/util/u_mm.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_mm.c b/src/gallium/auxiliary/util/u_mm.c
> index bd4c4e1b1060..7a45e291920e 100644
> --- a/src/gallium/auxiliary/util/u_mm.c
> +++ b/src/gallium/auxiliary/util/u_mm.c
> @@ -183,7 +183,10 @@ u_mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
>   
>      assert(size >= 0);
>      assert(align2 >= 0);
> -   assert(align2 <= 12); /* sanity check, 2^12 (4KB) enough? */
> +   /* Make sure that a byte alignment isn't getting passed for our
> +    * power-of-two alignment arg.
> +    */
> +   assert(align2 < 32);
>   
>      if (!heap || align2 < 0 || size <= 0)
>         return NULL;
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list