ubifs: Fix uninitialized variable in search_dh_cookie()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Sun, 17 Sep 2017 08:32:20 +0000 (10:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Apr 2018 09:02:07 +0000 (11:02 +0200)
commit2a71a742f09b390a200110dd3d8ff9f6f51f9443
tree9548618f735657bf9222491ee139db7df8acdfa1
parenta1dfcb01e374729f6920c3c07867914c5e848fb4
ubifs: Fix uninitialized variable in search_dh_cookie()

[ Upstream commit c877154d307f4a91e0b5b85b75535713dab945ae ]

fs/ubifs/tnc.c: In function ‘search_dh_cookie’:
fs/ubifs/tnc.c:1893: warning: ‘err’ is used uninitialized in this function

Indeed, err is always used uninitialized.

According to an original review comment from Hyunchul, acknowledged by
Richard, err should be initialized to -ENOENT to avoid the first call to
tnc_next().  But we can achieve the same by reordering the code.

Fixes: 781f675e2d7e ("ubifs: Fix unlink code wrt. double hash lookups")
Reported-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ubifs/tnc.c