All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles()
@ 2014-04-21 20:45 Eric Sandeen
  2014-04-22  6:27 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2014-04-21 20:45 UTC (permalink / raw)
  To: xfs-oss

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 c61a9e39).

Should resolve Coverity CID 1163872.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 3daf5ea..17ec2c2 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -278,9 +279,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);

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles()
  2014-04-21 20:45 [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles() Eric Sandeen
@ 2014-04-22  6:27 ` Christoph Hellwig
  2014-04-22 12:42   ` Jeff Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2014-04-22  6:27 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Mon, Apr 21, 2014 at 03:45:08PM -0500, Eric Sandeen wrote:
> 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 c61a9e39).
> 
> Should resolve Coverity CID 1163872.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles()
  2014-04-22  6:27 ` Christoph Hellwig
@ 2014-04-22 12:42   ` Jeff Liu
  2014-04-22 15:56     ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Liu @ 2014-04-22 12:42 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, xfs-oss


On 04/22 2014 14:27 PM, Christoph Hellwig wrote:
> On Mon, Apr 21, 2014 at 03:45:08PM -0500, Eric Sandeen wrote:
>> 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 c61a9e39).

Indeed, my mistake.

>>
>> Should resolve Coverity CID 1163872.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> Looks good,
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Looks good to me too.

Reviewed-by: Jie Liu <jeff.liu@oracle.com>


Thanks,
-Jeff

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles()
  2014-04-22 12:42   ` Jeff Liu
@ 2014-04-22 15:56     ` Eric Sandeen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2014-04-22 15:56 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Christoph Hellwig, xfs-oss

On 4/22/14, 7:42 AM, Jeff Liu wrote:
> 
> On 04/22 2014 14:27 PM, Christoph Hellwig wrote:
>> On Mon, Apr 21, 2014 at 03:45:08PM -0500, Eric Sandeen wrote:
>>> 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 c61a9e39).
> 
> Indeed, my mistake.

No worries, it's a very small thing, and programatically
impossible.  Not trying to point fingers, just looking for
whether it's a new warning or an old one.

Thanks,
-Eric

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-22 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 20:45 [PATCH] xfs: bulletfproof xfs_qm_scall_trunc_qfiles() Eric Sandeen
2014-04-22  6:27 ` Christoph Hellwig
2014-04-22 12:42   ` Jeff Liu
2014-04-22 15:56     ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.