All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sunrpc: silence build warning in gss_fill_context
@ 2013-02-07 15:29 Jeff Layton
  2013-02-17 20:32 ` Myklebust, Trond
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2013-02-07 15:29 UTC (permalink / raw)
  To: trond.myklebust; +Cc: andros, linux-nfs

Since commit 620038f6d23, gcc is throwing the following warning:

  CC [M]  net/sunrpc/auth_gss/auth_gss.o
In file included from include/linux/sunrpc/types.h:14:0,
                 from include/linux/sunrpc/sched.h:14,
                 from include/linux/sunrpc/clnt.h:18,
                 from net/sunrpc/auth_gss/auth_gss.c:45:
net/sunrpc/auth_gss/auth_gss.c: In function ‘gss_pipe_downcall’:
include/linux/sunrpc/debug.h:45:10: warning: ‘timeout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
    printk(KERN_DEFAULT args); \
          ^
net/sunrpc/auth_gss/auth_gss.c:194:15: note: ‘timeout’ was declared here
  unsigned int timeout;
               ^
If simple_get_bytes returns an error, then we'll end up calling printk
with an uninitialized timeout value. Reasonably harmless, but fairly
simple to fix by setting the timeout to 0 if it does.

Cc: Andy Adamson <andros@netapp.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 net/sunrpc/auth_gss/auth_gss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 6e5c824..b706b4c 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -201,8 +201,10 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
 	 * the -t value passed to GSSD.
 	 */
 	p = simple_get_bytes(p, end, &timeout, sizeof(timeout));
-	if (IS_ERR(p))
+	if (IS_ERR(p)) {
+		timeout = 0;
 		goto err;
+	}
 	if (timeout == 0)
 		timeout = GSSD_MIN_TIMEOUT;
 	ctx->gc_expiry = now + ((unsigned long)timeout * HZ);
-- 
1.7.11.7


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

* Re: [PATCH] sunrpc: silence build warning in gss_fill_context
  2013-02-07 15:29 [PATCH] sunrpc: silence build warning in gss_fill_context Jeff Layton
@ 2013-02-17 20:32 ` Myklebust, Trond
  2013-02-18 13:21   ` [PATCH v2] " Jeff Layton
  0 siblings, 1 reply; 3+ messages in thread
From: Myklebust, Trond @ 2013-02-17 20:32 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Adamson, Andy, linux-nfs

T24gVGh1LCAyMDEzLTAyLTA3IGF0IDEwOjI5IC0wNTAwLCBKZWZmIExheXRvbiB3cm90ZToNCj4g
U2luY2UgY29tbWl0IDYyMDAzOGY2ZDIzLCBnY2MgaXMgdGhyb3dpbmcgdGhlIGZvbGxvd2luZyB3
YXJuaW5nOg0KPiANCj4gICBDQyBbTV0gIG5ldC9zdW5ycGMvYXV0aF9nc3MvYXV0aF9nc3Mubw0K
PiBJbiBmaWxlIGluY2x1ZGVkIGZyb20gaW5jbHVkZS9saW51eC9zdW5ycGMvdHlwZXMuaDoxNDow
LA0KPiAgICAgICAgICAgICAgICAgIGZyb20gaW5jbHVkZS9saW51eC9zdW5ycGMvc2NoZWQuaDox
NCwNCj4gICAgICAgICAgICAgICAgICBmcm9tIGluY2x1ZGUvbGludXgvc3VucnBjL2NsbnQuaDox
OCwNCj4gICAgICAgICAgICAgICAgICBmcm9tIG5ldC9zdW5ycGMvYXV0aF9nc3MvYXV0aF9nc3Mu
Yzo0NToNCj4gbmV0L3N1bnJwYy9hdXRoX2dzcy9hdXRoX2dzcy5jOiBJbiBmdW5jdGlvbiDigJhn
c3NfcGlwZV9kb3duY2FsbOKAmToNCj4gaW5jbHVkZS9saW51eC9zdW5ycGMvZGVidWcuaDo0NTox
MDogd2FybmluZzog4oCYdGltZW91dOKAmSBtYXkgYmUgdXNlZA0KPiB1bmluaXRpYWxpemVkIGlu
IHRoaXMgZnVuY3Rpb24gWy1XbWF5YmUtdW5pbml0aWFsaXplZF0NCj4gICAgIHByaW50ayhLRVJO
X0RFRkFVTFQgYXJncyk7IFwNCj4gICAgICAgICAgIF4NCj4gbmV0L3N1bnJwYy9hdXRoX2dzcy9h
dXRoX2dzcy5jOjE5NDoxNTogbm90ZTog4oCYdGltZW91dOKAmSB3YXMgZGVjbGFyZWQgaGVyZQ0K
PiAgIHVuc2lnbmVkIGludCB0aW1lb3V0Ow0KPiAgICAgICAgICAgICAgICBeDQo+IElmIHNpbXBs
ZV9nZXRfYnl0ZXMgcmV0dXJucyBhbiBlcnJvciwgdGhlbiB3ZSdsbCBlbmQgdXAgY2FsbGluZyBw
cmludGsNCj4gd2l0aCBhbiB1bmluaXRpYWxpemVkIHRpbWVvdXQgdmFsdWUuIFJlYXNvbmFibHkg
aGFybWxlc3MsIGJ1dCBmYWlybHkNCj4gc2ltcGxlIHRvIGZpeCBieSBzZXR0aW5nIHRoZSB0aW1l
b3V0IHRvIDAgaWYgaXQgZG9lcy4NCg0KIEknZCBwcmVmZXIganVzdCBkb2luZyBhIHBhcmFtZXRl
cmVjdG9teSBvbiB0aGUgZHByaW50aygpLi4uIERvIHdlDQpyZWFsbHkgbmVlZCBpdCB0byByZXBv
cnQgYW55dGhpbmcgb3RoZXIgdGhhbiBqdXN0IHRoZSBlcnJvcj8NCg0KQ2hlZXJzDQogIFRyb25k
DQo=

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

* [PATCH v2] sunrpc: silence build warning in gss_fill_context
  2013-02-17 20:32 ` Myklebust, Trond
@ 2013-02-18 13:21   ` Jeff Layton
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2013-02-18 13:21 UTC (permalink / raw)
  To: trond.myklebust; +Cc: andros, linux-nfs

Since commit 620038f6d23, gcc is throwing the following warning:

  CC [M]  net/sunrpc/auth_gss/auth_gss.o
In file included from include/linux/sunrpc/types.h:14:0,
                 from include/linux/sunrpc/sched.h:14,
                 from include/linux/sunrpc/clnt.h:18,
                 from net/sunrpc/auth_gss/auth_gss.c:45:
net/sunrpc/auth_gss/auth_gss.c: In function ‘gss_pipe_downcall’:
include/linux/sunrpc/debug.h:45:10: warning: ‘timeout’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
    printk(KERN_DEFAULT args); \
          ^
net/sunrpc/auth_gss/auth_gss.c:194:15: note: ‘timeout’ was declared here
  unsigned int timeout;
               ^
If simple_get_bytes returns an error, then we'll end up calling printk
with an uninitialized timeout value. Remove the timeout from the
dprintk in order to remove the warning.

Cc: Andy Adamson <andros@netapp.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 net/sunrpc/auth_gss/auth_gss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 6e5c824..9f25403 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -247,8 +247,8 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
 		__func__, ctx->gc_expiry, now, timeout);
 	return q;
 err:
-	dprintk("RPC:       %s returns %ld gc_expiry %lu now %lu timeout %u\n",
-		__func__, -PTR_ERR(p), ctx->gc_expiry, now, timeout);
+	dprintk("RPC:       %s returns %ld gc_expiry %lu now %lu\n",
+		__func__, -PTR_ERR(p), ctx->gc_expiry, now);
 	return p;
 }
 
-- 
1.7.11.7


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

end of thread, other threads:[~2013-02-18 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 15:29 [PATCH] sunrpc: silence build warning in gss_fill_context Jeff Layton
2013-02-17 20:32 ` Myklebust, Trond
2013-02-18 13:21   ` [PATCH v2] " Jeff Layton

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.