Skip to contentSkip to conversation

sunrpc: silence build warning in gss_fill_context

PATCH Superseded Jeff Layton 2 participants 3 messages Feb 7, 2013 – Feb 18, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: silence build warning in gss_fill_context

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.

---
 net/sunrpc/auth_gss/auth_gss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +3 -1
index 6e5c824..b706b4c 100644
@@ -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);
Signature · 1 line
1.7.11.7
#1 lore raw

T24gVGh1LCAyMDEzLTAyLTA3IGF0IDEwOjI5IC0wNTAwLCBKZWZmIExheXRvbiB3cm90ZToNCj4g U2luY2UgY29tbWl0IDYyMDAzOGY2ZDIzLCBnY2MgaXMgdGhyb3dpbmcgdGhlIGZvbG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mYWlybHkNCj4gc2ltcGxlIHRvIGZpeCBieSBzZXR0aW5nIHRoZSB0aW1l b3V0IHRvIDAgaWYgaXQgZG9lcy4NCg0KIEknZCBwcmVmZXIganVzdCBkb2luZyBhIHBhcmFtZXRl cmVjdG9teSBvbiB0aGUgZHByaW50aygpLi4uIERvIHdlDQpyZWFsbHkgbmVlZCBpdCB0byByZXBv cnQgYW55dGhpbmcgb3RoZXIgdGhhbiBqdXN0IHRoZSBlcnJvcj8NCg0KQ2hlZXJzDQogIFRyb25k DQo=

#2 lore raw

PATCH v2 1/1 sunrpc: silence build warning in gss_fill_context

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.

---
 net/sunrpc/auth_gss/auth_gss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +2 -2
index 6e5c824..9f25403 100644
@@ -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;
 }
 
Signature · 1 line
1.7.11.7