summary refs log tree commit diff
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2014-01-06 11:28:41 +0800
committerJ. Bruce Fields <bfields@redhat.com>2014-01-06 12:23:31 -0500
commitff88825fbb9f5a503164bb5ad4a8c65dabfa13e0 (patch)
tree11a964af266c0357a917f95e3710bb74656033a0
parent8ef667140c52e9b88934664954217f28559c75d6 (diff)
downloadlinux-ff88825fbb9f5a503164bb5ad4a8c65dabfa13e0.tar.gz
NFSD: fix compile warning without CONFIG_NFSD_V3
Without CONFIG_NFSD_V3, compile will get warning as,

fs/nfsd/nfssvc.c: In function 'nfsd_svc':
>> fs/nfsd/nfssvc.c:246:60: warning: array subscript is above array bounds [-Warray-bounds]
        return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);
                                                               ^

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfssvc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 55b5b57b5715..9a4a5f9e7468 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -243,7 +243,11 @@ static void nfsd_shutdown_generic(void)
 
 static bool nfsd_needs_lockd(void)
 {
+#if defined(CONFIG_NFSD_V3)
 	return (nfsd_versions[2] != NULL) || (nfsd_versions[3] != NULL);
+#else
+	return (nfsd_versions[2] != NULL);
+#endif
 }
 
 static int nfsd_startup_net(int nrservs, struct net *net)