ZFS: Fix invalid memcmp

We ended up comparing over unset values as we had dnode_phys on one side
and dnode on another

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Vladimir Serbinenko 2023-07-06 17:12:09 +02:00
parent 42a831d746
commit 96446ce14e

View File

@ -2684,8 +2684,8 @@ dnode_get (dnode_end_t * mdn, grub_uint64_t objnum, grub_uint8_t type,
blkid = objnum >> epbs;
idx = objnum & ((1 << epbs) - 1);
if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, mdn,
sizeof (*mdn)) == 0
if (data->dnode_buf != NULL && grub_memcmp (data->dnode_mdn, &mdn->dn,
sizeof (mdn->dn)) == 0
&& objnum >= data->dnode_start && objnum < data->dnode_end)
{
grub_memmove (&(buf->dn), &(data->dnode_buf)[idx], DNODE_SIZE);