mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] ubifs: fix uninitialized error variable err
@ 2017-07-17 16:00 Colin King
  2017-07-17 16:03 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-07-17 16:00 UTC (permalink / raw)
  To: Richard Weinberger, Artem Bityutskiy, Adrian Hunter, linux-mtd
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable err is not initialized and so the check to see if it is
non-zero is basically checking a random garbage value. Fix this
by initializing err to zero.

Detected by CoverityScan, CID#1451370 ("Uninitialized variable")

Fixes: 781f675e2d7e ("ubifs: Fix unlink code wrt. double hash lookups")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/ubifs/tnc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 0a213dcba2a1..ec18304fe0e1 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -1884,7 +1884,7 @@ static int search_dh_cookie(struct ubifs_info *c, const union ubifs_key *key,
 			    struct ubifs_dent_node *dent, uint32_t cookie,
 			    struct ubifs_znode **zn, int *n)
 {
-	int err;
+	int err = 0;
 	struct ubifs_znode *znode = *zn;
 	struct ubifs_zbranch *zbr;
 	union ubifs_key *dkey;
-- 
2.11.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-17 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 16:00 [PATCH][next] ubifs: fix uninitialized error variable err Colin King
2017-07-17 16:03 ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®