zink: avoid memcmping null pointers

memcmping NULL pointers is not allowed, and would lead to a crash here.
So let's check that the first isn't NULL; we've already checked that
they're not *both* NULL, so checking one is enough.

CID: 1484801, 1484810

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
This commit is contained in:
Erik Faye-Lund 2021-08-26 11:36:21 +02:00 committed by Marge Bot
parent d3a795b528
commit 75b5f12407

View file

@ -336,7 +336,9 @@ equals_gfx_pipeline_state(const void *a, const void *b)
if (sa->dyn_state1.front_face != sb->dyn_state1.front_face)
return false;
if (!!sa->dyn_state1.depth_stencil_alpha_state != !!sb->dyn_state1.depth_stencil_alpha_state ||
memcmp(sa->dyn_state1.depth_stencil_alpha_state, sb->dyn_state1.depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state)))
(sa->dyn_state1.depth_stencil_alpha_state &&
memcmp(sa->dyn_state1.depth_stencil_alpha_state, sb->dyn_state1.depth_stencil_alpha_state,
sizeof(struct zink_depth_stencil_alpha_hw_state))))
return false;
}
if (!sa->have_EXT_extended_dynamic_state2) {