All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ubifs: do not decide upon uninitialized variable
@ 2020-12-25 14:19 Heinrich Schuchardt
  2020-12-26  7:08 ` Chris Packham
  2021-01-20 21:46 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2020-12-25 14:19 UTC (permalink / raw)
  To: u-boot

Before 'if (err)' we have to initialize the variable otherwise we use a
random value from the stack.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/ubifs/io.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index eb14b89544..9962cbe7eb 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -114,7 +114,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,
 int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
 		    int len)
 {
-	int err;
+	int err = 0;

 	ubifs_assert(!c->ro_media && !c->ro_mount);
 	if (c->ro_error)
@@ -136,7 +136,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,

 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len)
 {
-	int err;
+	int err = 0;

 	ubifs_assert(!c->ro_media && !c->ro_mount);
 	if (c->ro_error)
@@ -158,7 +158,7 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len)

 int ubifs_leb_unmap(struct ubifs_info *c, int lnum)
 {
-	int err;
+	int err = 0;

 	ubifs_assert(!c->ro_media && !c->ro_mount);
 	if (c->ro_error)
@@ -179,7 +179,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum)

 int ubifs_leb_map(struct ubifs_info *c, int lnum)
 {
-	int err;
+	int err = 0;

 	ubifs_assert(!c->ro_media && !c->ro_mount);
 	if (c->ro_error)
--
2.29.2

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

end of thread, other threads:[~2021-01-20 21:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25 14:19 [PATCH 1/1] ubifs: do not decide upon uninitialized variable Heinrich Schuchardt
2020-12-26  7:08 ` Chris Packham
2020-12-26  7:34   ` Heinrich Schuchardt
2020-12-27  7:38     ` Chris Packham
2021-01-20 21:46 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.