All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sean Young <sean@mess.org>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	linux-s390@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	x86@kernel.org, Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Russell King <linux@armlinux.org.uk>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	linux-snps-arc@lists.infradead.org, linux-media@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kbuild@vger.kernel.org, Jiri Kosina <jikos@kernel.org>,
	Michal Marek <mmarek@suse.com>,
	nios2-dev@lists.rocketboards.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	linux-crypto@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Ley Foon Tan <lftan@altera.com>,
	Andrew Morton <akpm@linux-found
Subject: [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning
Date: Thu, 10 Nov 2016 17:44:45 +0100	[thread overview]
Message-ID: <20161110164454.293477-3-arnd@arndb.de> (raw)
In-Reply-To: <20161110164454.293477-1-arnd@arndb.de>

A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:

fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.

Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
First submitted on Aug 31, but ended up not getting applied then
as the warning was disabled in v4.8-rc

Anna Schumaker said at the kernel summit that she had applied
it and would send it for 4.9, but as of 2016-11-09 it has not
made it into linux-next.

 fs/nfs/nfs4session.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..150c5a1 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 	__must_hold(&tbl->slot_tbl_lock)
 {
 	struct nfs4_slot *slot;
+	int ret;
 
 	slot = nfs4_lookup_slot(tbl, slotid);
-	if (IS_ERR(slot))
-		return PTR_ERR(slot);
-	*seq_nr = slot->seq_nr;
-	return 0;
+	ret = PTR_ERR_OR_ZERO(slot);
+	if (!ret)
+		*seq_nr = slot->seq_nr;
+
+	return ret;
 }
 
 /*
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"David S. Miller" <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Ilya Dryomov <idryomov@gmail.com>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Jiri Kosina <jikos@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Ley Foon Tan <lftan@altera.com>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Michal Marek <mmarek@suse.com>,
	Russell King <linux@armlinux.org.uk>, Sean Young <sean@mess.org>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	x86@kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org,
	nios2-dev@lists.rocketboards.org, linux-s390@vger.kernel.org,
	linux-crypto@vger.kernel.org, linux-media@vger.kernel.org,
	linux-nfs@vger.kernel.org
Subject: [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning
Date: Thu, 10 Nov 2016 17:44:45 +0100	[thread overview]
Message-ID: <20161110164454.293477-3-arnd@arndb.de> (raw)
In-Reply-To: <20161110164454.293477-1-arnd@arndb.de>

A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:

fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.

Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
First submitted on Aug 31, but ended up not getting applied then
as the warning was disabled in v4.8-rc

Anna Schumaker said at the kernel summit that she had applied
it and would send it for 4.9, but as of 2016-11-09 it has not
made it into linux-next.

 fs/nfs/nfs4session.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..150c5a1 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 	__must_hold(&tbl->slot_tbl_lock)
 {
 	struct nfs4_slot *slot;
+	int ret;
 
 	slot = nfs4_lookup_slot(tbl, slotid);
-	if (IS_ERR(slot))
-		return PTR_ERR(slot);
-	*seq_nr = slot->seq_nr;
-	return 0;
+	ret = PTR_ERR_OR_ZERO(slot);
+	if (!ret)
+		*seq_nr = slot->seq_nr;
+
+	return ret;
 }
 
 /*
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sean Young <sean@mess.org>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	linux-s390@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	x86@kernel.org, Sebastian Ott <sebott@linux.vnet.ibm.com>,
	Russell King <linux@armlinux.org.uk>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	linux-snps-arc@lists.infradead.org, linux-media@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kbuild@vger.kernel.org, Jiri Kosina <jikos@kernel.org>,
	Michal Marek <mmarek@suse.com>,
	nios2-dev@lists.rocketboards.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	linux-crypto@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Ley Foon Tan <lftan@altera.com>, Andrew Morton <akpm@linux-found>
Subject: [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning
Date: Thu, 10 Nov 2016 17:44:45 +0100	[thread overview]
Message-ID: <20161110164454.293477-3-arnd@arndb.de> (raw)
In-Reply-To: <20161110164454.293477-1-arnd@arndb.de>

A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:

fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.

Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
First submitted on Aug 31, but ended up not getting applied then
as the warning was disabled in v4.8-rc

Anna Schumaker said at the kernel summit that she had applied
it and would send it for 4.9, but as of 2016-11-09 it has not
made it into linux-next.

 fs/nfs/nfs4session.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..150c5a1 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 	__must_hold(&tbl->slot_tbl_lock)
 {
 	struct nfs4_slot *slot;
+	int ret;
 
 	slot = nfs4_lookup_slot(tbl, slotid);
-	if (IS_ERR(slot))
-		return PTR_ERR(slot);
-	*seq_nr = slot->seq_nr;
-	return 0;
+	ret = PTR_ERR_OR_ZERO(slot);
+	if (!ret)
+		*seq_nr = slot->seq_nr;
+
+	return ret;
 }
 
 /*
-- 
2.9.0

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning
Date: Thu, 10 Nov 2016 17:44:45 +0100	[thread overview]
Message-ID: <20161110164454.293477-3-arnd@arndb.de> (raw)
In-Reply-To: <20161110164454.293477-1-arnd@arndb.de>

A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:

fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.

Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann <arnd at arndb.de>
---
First submitted on Aug 31, but ended up not getting applied then
as the warning was disabled in v4.8-rc

Anna Schumaker said at the kernel summit that she had applied
it and would send it for 4.9, but as of 2016-11-09 it has not
made it into linux-next.

 fs/nfs/nfs4session.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..150c5a1 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table  *tbl, u32 slotid,
 	__must_hold(&tbl->slot_tbl_lock)
 {
 	struct nfs4_slot *slot;
+	int ret;
 
 	slot = nfs4_lookup_slot(tbl, slotid);
-	if (IS_ERR(slot))
-		return PTR_ERR(slot);
-	*seq_nr = slot->seq_nr;
-	return 0;
+	ret = PTR_ERR_OR_ZERO(slot);
+	if (!ret)
+		*seq_nr = slot->seq_nr;
+
+	return ret;
 }
 
 /*
-- 
2.9.0

  parent reply	other threads:[~2016-11-10 16:44 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 01/11] Kbuild: enable -Wmaybe-uninitialized warning for "make W=1" Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` Arnd Bergmann [this message]
2016-11-10 16:44   ` [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 03/11] x86: apm: avoid uninitialized data Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 04/11] nios2: fix timer initcall return value Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 05/11] s390: pci: don't print uninitialized data for debugging Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 06/11] [media] dib0700: fix nec repeat handling Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 07/11] [media] rc: print correct variable for z8f0811 Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 08/11] crypto: aesni: shut up -Wmaybe-uninitialized warning Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 09/11] [v3] infiniband: shut up a maybe-uninitialized warning Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 10/11] pcmcia: fix return value of soc_pcmcia_regulator_set Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 11/11] Kbuild: enable -Wmaybe-uninitialized warnings by default Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
2016-11-10 16:44   ` Arnd Bergmann
     [not found] ` <20161110164454.293477-1-arnd-r2nGTMty4D4@public.gmane.org>
2016-11-11 17:13   ` [PATCH v2 00/11] getting back -Wmaybe-uninitialized Linus Torvalds
2016-11-11 17:13     ` Linus Torvalds
2016-11-11 17:13     ` Linus Torvalds
2016-11-11 17:13     ` Linus Torvalds
2016-11-11 19:49     ` Arnd Bergmann
2016-11-11 19:49       ` Arnd Bergmann
2016-11-11 19:49       ` Arnd Bergmann
2016-11-11 19:49       ` Arnd Bergmann
2016-11-12 13:27       ` Jonathan Cameron
2016-11-12 13:27         ` Jonathan Cameron
2016-11-13  8:47         ` Greg KH
2016-11-13  8:47           ` Greg KH
2016-11-13  8:47           ` Greg KH
2016-11-13 10:31           ` Greg KH
2016-11-13 10:31             ` Greg KH
2016-11-13 10:31             ` Greg KH

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=20161110164454.293477-3-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-found \
    --cc=anna.schumaker@netapp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=idryomov@gmail.com \
    --cc=javier@osg.samsung.com \
    --cc=jikos@kernel.org \
    --cc=lftan@altera.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=mcgrof@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mmarek@suse.com \
    --cc=nios2-dev@lists.rocketboards.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sean@mess.org \
    --cc=sebott@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=trond.myklebust@primarydata.com \
    --cc=x86@kernel.org \
    /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.