9
0
Fork 0

environment: Fix unitiliazed variable

envfs_load_data needs a pointer to the envfs_super, otherwise it
works on an unitialized struct when detecting the envfs version.

This is broken since:

| commit 0a2a8f7059
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date:   Thu Feb 20 08:16:01 2014 +0100
|
|     environment: Add function to load envfs from buffer
|
|     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Grmpf. Most compilers do not issue a warning, only the blackfin
gcc 4.3.5 warns about this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-03-29 06:44:57 +01:00
parent 258772deab
commit 0ae451a7bc
1 changed files with 5 additions and 5 deletions

View File

@ -253,9 +253,9 @@ static int envfs_check_data(struct envfs_super *super, const void *buf, size_t s
return 0;
}
static int envfs_load_data(void *buf, size_t size, const char *dir, unsigned flags)
static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
const char *dir, unsigned flags)
{
struct envfs_super super;
int fd, ret = 0;
char *str, *tmp;
int headerlen_full;
@ -281,7 +281,7 @@ static int envfs_load_data(void *buf, size_t size, const char *dir, unsigned fla
inode_size = ENVFS_32(inode->size);
inode_headerlen = ENVFS_32(inode->headerlen);
namelen = strlen(inode->data) + 1;
if (super.major < 1)
if (super->major < 1)
inode_end = &inode_end_dummy;
else
inode_end = (struct envfs_inode_end *)(buf + PAD4(namelen));
@ -363,7 +363,7 @@ int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags)
if (ret)
return ret;
ret = envfs_load_data(buf, size, dir, flags);
ret = envfs_load_data(super, buf, size, dir, flags);
return ret;
}
@ -415,7 +415,7 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
if (ret)
goto out;
ret = envfs_load_data(buf, size, dir, flags);
ret = envfs_load_data(&super, buf, size, dir, flags);
if (ret)
goto out;