]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
nfsd: avoid uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 22 Mar 2019 14:07:11 +0000 (15:07 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitffc181e4adb5f3e026c722349571531f77fcfbd0
tree500e956593bd2ef5c1565c90832d9033c5384a01
parentde655aa7eb69b120459d0332d6ccf02334c1ab0a
nfsd: avoid uninitialized variable warning

BugLink: https://bugs.launchpad.net/bugs/1838824
[ Upstream commit 0ab88ca4bcf18ba21058d8f19220f60afe0d34d8 ]

clang warns that 'contextlen' may be accessed without an initialization:

fs/nfsd/nfs4xdr.c:2911:9: error: variable 'contextlen' is uninitialized when used here [-Werror,-Wuninitialized]
                                                                contextlen);
                                                                ^~~~~~~~~~
fs/nfsd/nfs4xdr.c:2424:16: note: initialize the variable 'contextlen' to silence this warning
        int contextlen;
                      ^
                       = 0

Presumably this cannot happen, as FATTR4_WORD2_SECURITY_LABEL is
set if CONFIG_NFSD_V4_SECURITY_LABEL is enabled.
Adding another #ifdef like the other two in this function
avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/nfsd/nfs4xdr.c