Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ubifs: potential uninitialized variable in truncate_data_node()
@ 2017-01-05 12:46 Dan Carpenter
  2017-01-05 12:54 ` Anurag Raghavan (RBEI/ETW11)
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-01-05 12:46 UTC (permalink / raw)
  To: Richard Weinberger, David Gstir
  Cc: Artem Bityutskiy, Adrian Hunter, linux-mtd, kernel-janitors

GCC doesn't complain, but my static checker warns that if the data is
not compressed and not encrypted then "ret" isn't initialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index a459211a1c21..c54f04d88236 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -1281,7 +1281,8 @@ static int truncate_data_node(const struct ubifs_info *c, const struct inode *in
 			      int *new_len)
 {
 	void *buf;
-	int err, dlen, compr_type, out_len, old_dlen;
+	int dlen, compr_type, out_len, old_dlen;
+	int err = 0;
 
 	out_len = le32_to_cpu(dn->size);
 	buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS);

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

end of thread, other threads:[~2017-01-06  5:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-05 12:46 [patch] ubifs: potential uninitialized variable in truncate_data_node() Dan Carpenter
2017-01-05 12:54 ` Anurag Raghavan (RBEI/ETW11)
2017-01-05 13:12   ` Richard Weinberger
2017-01-05 13:22     ` Anurag Raghavan (RBEI/ETW11)
2017-01-06  5:18     ` Anurag Raghavan (RBEI/ETW11)

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