diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2021-05-31 22:56:34 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2021-06-07 01:03:38 +0000 |
| commit | f9b3922257ba343c824784f727da1805e71ce8d8 (patch) | |
| tree | 260c4e1538fe1f108332abd29a56d89940b5c95b | |
| parent | cbced258dee43b4f65e62572aa2fcd67225eca20 (diff) | |
ffs: Correct the input size check in sysctl_ffs_fsck()
Make sure we return an error if no input was specified, since
SYSCTL_IN() will report success in that case.
Reported by: KMSAN
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b2f9575646f89cdddcad76acae3e9305535506a2)
| -rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 6d9b459ccfd7..842b88ec178c 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -3153,9 +3153,9 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) int filetype, error; static struct fileops *origops, bufferedops; - if (req->newlen > sizeof cmd) + if (req->newptr == NULL || req->newlen > sizeof(cmd)) return (EBADRPC); - if ((error = SYSCTL_IN(req, &cmd, sizeof cmd)) != 0) + if ((error = SYSCTL_IN(req, &cmd, sizeof(cmd))) != 0) return (error); if (cmd.version != FFS_CMD_VERSION) return (ERPCMISMATCH); |
