Skip to content

Commit 81f5627

Browse files
xyprontrini
authored andcommitted
ubifs: do not decide upon uninitialized variable
Before 'if (err)' we have to initialize the variable otherwise we use a random value from the stack. Signed-off-by: Heinrich Schuchardt <[email protected]>
1 parent 3b00a6b commit 81f5627

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/ubifs/io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,
114114
int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
115115
int len)
116116
{
117-
int err;
117+
int err = 0;
118118

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)