vc4: do not pass NULL pointer to function not expecting NULLs
memcmp() pointers arguments are declared to be non NULL. This has been detected by Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29911>
This commit is contained in:

committed by
Marge Bot

parent
eab3ee8d71
commit
2a16575dec
@@ -2918,11 +2918,18 @@ fs_inputs_compare(const void *key1, const void *key2)
|
||||
const struct vc4_fs_inputs *inputs1 = key1;
|
||||
const struct vc4_fs_inputs *inputs2 = key2;
|
||||
|
||||
return (inputs1->num_inputs == inputs2->num_inputs &&
|
||||
memcmp(inputs1->input_slots,
|
||||
inputs2->input_slots,
|
||||
sizeof(*inputs1->input_slots) *
|
||||
inputs1->num_inputs) == 0);
|
||||
if (inputs1->num_inputs == inputs2->num_inputs) {
|
||||
if (inputs1->num_inputs == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return memcmp(inputs1->input_slots,
|
||||
inputs2->input_slots,
|
||||
sizeof(*inputs1->input_slots) *
|
||||
inputs1->num_inputs) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user