]> git.ipfire.org Git - thirdparty/grub.git/commit
fs/zfs/zfs: Avoid pointer downcasting in dnode_get()
authorAlec Brown <alec.r.brown@oracle.com>
Mon, 17 Nov 2025 07:11:15 +0000 (07:11 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 18 Nov 2025 13:34:44 +0000 (14:34 +0100)
commit95e614a11b6bd3f5bf0df5157fed588fef1ae9cb
tree716bcb8330cb214dbe264620ebf4bd713f41277b
parent2464d43829588909cc6c69027c7d965000e632c1
fs/zfs/zfs: Avoid pointer downcasting in dnode_get()

Coverity marks multiple issues in grub-core/fs/zfs/zfs.c as either "Untrusted
value as argument", "Untrusted pointer read", or "Untrusted loop bound". Each
of these issues share a common cause where Coverity finds that data->dnode_buf
gets tainted by dnbuf since it is downcasting from (void *) to (dnode_phys_t *)
and could imply that the data the pointer points to is tainted. However, the
function zio_read(), which reads this data from disk, sanitizes this data by
verifying its checksum. To resolve the issues for Coverity, setting dnbuf to
(dnode_phys_t *) at the start of the function dnode_get() seems to do the trick.

Fixes: CID 314020
Fixes: CID 896330
Fixes: CID 896331
Fixes: CID 896334
Fixes: CID 896336
Fixes: CID 896340
Fixes: CID 897337
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/zfs/zfs.c