sunrpc: avoid warning in gss_key_timeout
authorArnd Bergmann <arnd@arndb.de>
Fri, 9 Oct 2015 14:13:45 +0000 (16:13 +0200)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Oct 2015 19:57:28 +0000 (15:57 -0400)
commitcc6a7aab5570beef884ff95f7cade6634bf815a1
tree1b4b0be6f3585682c5d45fd1877f7c5428971e86
parent0d0f4aab4e4d290138a4ae7f2ef8469e48c9a669
sunrpc: avoid warning in gss_key_timeout

The gss_key_timeout() function causes a harmless warning in some
configurations, e.g. ARM imx_v6_v7_defconfig with gcc-5.2, if the
compiler cannot figure out the state of the 'expire' variable across
an rcu_read_unlock():

net/sunrpc/auth_gss/auth_gss.c: In function 'gss_key_timeout':
net/sunrpc/auth_gss/auth_gss.c:1422:211: warning: 'expire' may be used uninitialized in this function [-Wmaybe-uninitialized]

To avoid this warning without adding a bogus initialization, this
rewrites the function so the comparison is done inside of the
critical section. As a side-effect, it also becomes slightly
easier to understand because the implementation now more closely
resembles the comment above it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: c5e6aecd034e7 ("sunrpc: fix RCU handling of gc_ctx field")
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/auth_gss/auth_gss.c