mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Trond Myklebust <trond.myklebust@primarydata.com>
Cc: <linux-nfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NFSv4.x: hide array-bounds warning
Date: Tue, 22 Nov 2016 16:53:33 -0500	[thread overview]
Message-ID: <138e311e-4972-5726-53c2-b4fddf2576ef@Netapp.com> (raw)
In-Reply-To: <20161122205059.754211-1-arnd@arndb.de>

Thanks, Arnd!  I'll send it for 4.9

Anna

On 11/22/2016 03:50 PM, Arnd Bergmann wrote:
> A correct bugfix introduced a harmless warning that shows up with gcc-7:
> 
> fs/nfs/callback.c: In function 'nfs_callback_up':
> fs/nfs/callback.c:214:14: error: array subscript is outside array bounds [-Werror=array-bounds]
> 
> What happens here is that the 'minorversion == 0' check tells the
> compiler that we assume minorversion can be something other than 0,
> but when CONFIG_NFS_V4_1 is disabled that would be invalid and
> result in an out-of-bounds access.
> 
> The added check for IS_ENABLED(CONFIG_NFS_V4_1) tells gcc that this
> really can't happen, which makes the code slightly smaller and also
> avoids the warning.
> 
> The bugfix that introduced the warning is marked for stable backports,
> we want this one backported to the same releases.
> 
> Fixes: 98b0f80c2396 ("NFSv4.x: Fix a refcount leak in nfs_callback_up_net")
> Cc: stable@vger.kernel.org # v3.7+
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  fs/nfs/callback.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
> index 532d8e242d4d..484bebc20bca 100644
> --- a/fs/nfs/callback.c
> +++ b/fs/nfs/callback.c
> @@ -197,7 +197,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
>  	}
>  
>  	ret = -EPROTONOSUPPORT;
> -	if (minorversion == 0)
> +	if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
>  		ret = nfs4_callback_up_net(serv, net);
>  	else if (xprt->ops->bc_up)
>  		ret = xprt->ops->bc_up(serv, net);
> 

      reply	other threads:[~2016-11-22 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 20:50 Arnd Bergmann
2016-11-22 21:53 ` Anna Schumaker [this message]

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=138e311e-4972-5726-53c2-b4fddf2576ef@Netapp.com \
    --to=anna.schumaker@netapp.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®