Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: check for null dquot in xfs_quota_calc_throttle()

Coverity spotted this.

Granted, we *just* checked xfs_inod_dquot() in the caller (by
calling xfs_quota_need_throttle). However, this is the only place we
don't check the return value but the check is cheap and future-proof
so add it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Eric Sandeen and committed by
Dave Chinner
5cca3f61 04dd1a0d

+2 -2
+2 -2
fs/xfs/xfs_iomap.c
··· 404 404 int shift = 0; 405 405 struct xfs_dquot *dq = xfs_inode_dquot(ip, type); 406 406 407 - /* over hi wmark, squash the prealloc completely */ 408 - if (dq->q_res_bcount >= dq->q_prealloc_hi_wmark) { 407 + /* no dq, or over hi wmark, squash the prealloc completely */ 408 + if (!dq || dq->q_res_bcount >= dq->q_prealloc_hi_wmark) { 409 409 *qblocks = 0; 410 410 *qfreesp = 0; 411 411 return;