Skip to content

Commit

Permalink
FreeBSD: Fix out of bounds read in zfs_ioctl_ozfs_to_legacy()
Browse files Browse the repository at this point in the history
There is an off by 1 error in the check. Fortunately, this function does
not appear to be used in kernel space, despite being compiled as part of
the kernel module.

This was reported by FreeBSD's coverity scan.

Reported-by: Coverity (CID 1432059)
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
  • Loading branch information
ryao committed Nov 3, 2022
1 parent 1e1ce10 commit 9afb76c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_ioctl_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ zfs_ioctl_legacy_to_ozfs(int request)
int
zfs_ioctl_ozfs_to_legacy(int request)
{
if (request > ZFS_IOC_LAST)
if (request >= ZFS_IOC_LAST)
return (-1);

if (request > ZFS_IOC_PLATFORM) {
Expand Down

0 comments on commit 9afb76c

Please sign in to comment.