9
0
Fork 0

mtd: concat: initialize *retlen

In concat_write and concat_read *retlen is only added to, but it's never
initialized. If the caller hasn't initialized retlen doesn't contain
valid values. Fix this by initializing *retlen properly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2015-07-07 16:24:23 +02:00
parent db48d9d190
commit 4955c2c1bc
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,8 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len,
int ret = 0, err;
int i;
*retlen = 0;
for (i = 0; i < concat->num_subdev; i++) {
struct mtd_info *subdev = concat->subdev[i];
size_t size, retsize;
@ -118,6 +120,8 @@ concat_write(struct mtd_info *mtd, loff_t to, size_t len,
int err = -EINVAL;
int i;
*retlen = 0;
for (i = 0; i < concat->num_subdev; i++) {
struct mtd_info *subdev = concat->subdev[i];
size_t size, retsize;