This just ensures that we don't end up reading/writing outside of the
space reserved in the key. This would have made it easier to to track
down the issue in the previous commit faster.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10730>
static inline int translate_keysize( const struct translate_key *key )
{
+ assert(key->nr_elements <= TRANSLATE_MAX_ATTRIBS);
return 2 * sizeof(int) + key->nr_elements * sizeof(struct translate_element);
}