All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bill O'Donnell" <billodo@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs_quota: Fix test for wrapped id from GETNEXTQUOTA
Date: Wed, 21 Dec 2016 10:09:35 -0600	[thread overview]
Message-ID: <20161221160935.GA402@redhat.com> (raw)
In-Reply-To: <44762cf0-ec69-4cb0-ee08-d5889f24df4b@redhat.com>

On Wed, Dec 21, 2016 at 09:13:08AM -0600, Eric Sandeen wrote:
> dump_file and report_mount can be called with null *oid if
> we aren't asking for the GETNEXTQUOTA interface, so we
> should only test for the GETNEXTQUOTA wrap if *oid is
> non-null.  Otherwise we'll deref a null pointer in the
> test.
> 
> This only happens for certain invocations of reporting,
> which apparently are not covered by any regression tests
> at this point, at least on new kernels which contain
> GETNEXTQUOTA.
> 
> Addresses-Coverity-ID: 1397415
> Addresses-Coverity-ID: 1397416
> Brown-paper-bag-worn-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/quota/report.c b/quota/report.c
> index fc02302..3833dd6 100644
> --- a/quota/report.c
> +++ b/quota/report.c
> @@ -98,12 +98,12 @@ dump_file(
>  		return 0;
>  	}
>  
> -	if (oid)
> +	if (oid) {
>  		*oid = d.d_id;
> -
> -	/* Did kernelspace wrap? */
> -	if (*oid < id)
> -		return 0;
> +		/* Did kernelspace wrap? */
> +		if (*oid < id)
> +			return 0;
> +	}
>  
>  	if (!d.d_blk_softlimit && !d.d_blk_hardlimit &&
>  	    !d.d_ino_softlimit && !d.d_ino_hardlimit &&
> @@ -361,12 +361,12 @@ report_mount(
>  		return 0;
>  	}
>  
> -	if (oid)
> +	if (oid) {
>  		*oid = d.d_id;
> -
> -	/* Did kernelspace wrap? */
> -	if (*oid < id)
> -		return 0;
> +		/* Did kernelspace wrap? */
> +		if (* oid < id)
> +			return 0;
> +	}
>  
>  	if (flags & TERSE_FLAG) {
>  		count = 0;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-12-21 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 15:13 [PATCH] xfs_quota: Fix test for wrapped id from GETNEXTQUOTA Eric Sandeen
2016-12-21 16:09 ` Bill O'Donnell [this message]
2016-12-22  9:22 ` Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161221160935.GA402@redhat.com \
    --to=billodo@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.