On Mon, Dec 14, 2015 at 12:32:13PM -0700, Stephen Warren wrote: > On 12/09/2015 05:54 PM, Tom Rini wrote: > >The function ext4fs_free_node() exists for dealing with "dirnode" > >structures that we allocate. However, we do not allocate these > >dynamically as needed but rather as a single instance in ext4fs_mount() > >that we zalloc(). Coverity scan notes that in two places we're doing > >what it calls a "Free of address-of expression" as we were free()'ing > >oldnode. However, oldnode was never directly allocated, nor any other > >instance which we were calling ext4fs_free_node() on. Removing this > >structure allows us to also restructure ext4fs_close() slightlu too. > > > >Tested on OMAP4 Pandaboard with Fedora 23 (/boot is ext4) as well as > >reading and writing files from / to /boot and vice-versa and confirming > >they read back again correctly. > > I think if this change was valid, then we could delete the global > variable ext4fs_file, and replace all references to it with a > reference to the dirnode member in struct ext2_data? > > Anyway, I believe that the-value-pointed-at-by-ext4fs_file is > dynamically allocated outside struct ext2_data sometimes: > > (All line number references relative to 5076c64a08d2 "Merge branch > 'master' of git://git.denx.de/u-boot-spi") > > 2187 int ext4fs_open(const char *filename, loff_t *len) > ... > 2196 status = ext4fs_find_file(filename, &ext4fs_root->diropen, ... > ... > 2208 ext4fs_file = fdiro; > > calls > > 2163 int ext4fs_find_file(... > 2164 struct ext2fs_node **foundnode, int expecttype) > ... > 2173 status = ext4fs_find_file1(path, rootnode, foundnode, ... > > calls > > 2063 static int ext4fs_find_file1(const char *currpath, > ... > 2105 found = ext4fs_iterate_dir(currnode, name, &currnode,... > ... > 2154 *currfound = currnode; > > calls: > > fs/ext4/ext4_common.c: > 1896 int ext4fs_iterate_dir(struct ext2fs_node *dir, char *name, > ... > 1941 fdiro = zalloc(sizeof(struct ext2fs_node)); > ... > 1991 *fnode = fdiro;
Ah, yes, I missed that one, good catch, thanks! -- Tom
signature.asc
Description: Digital signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot