Skip to content

Commit

Permalink
xfs: bulletfproof xfs_qm_scall_trunc_qfiles()
Browse files Browse the repository at this point in the history
Coverity noticed that if we sent junk into
xfs_qm_scall_trunc_qfiles(), we could get back an
uninitialized error value.  So sanitize the flags we
will accept, and initialize error anyway for good measure.

(This bug may have been introduced via c61a9e3).

Should resolve Coverity CID 1163872.

Signed-off-by: Eric Sandeen <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jie Liu <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
  • Loading branch information
Eric Sandeen authored and dchinner committed May 5, 2014
1 parent 9da93f9 commit f58522c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/xfs/xfs_qm_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,10 @@ xfs_qm_scall_trunc_qfiles(
xfs_mount_t *mp,
uint flags)
{
int error;
int error = EINVAL;

if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0 ||
(flags & ~XFS_DQ_ALLTYPES)) {
xfs_debug(mp, "%s: flags=%x m_qflags=%x",
__func__, flags, mp->m_qflags);
return XFS_ERROR(EINVAL);
Expand Down

0 comments on commit f58522c

Please sign in to comment.