All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fs: ext4: Remove ext4fs_free_node()
Date: Mon, 14 Dec 2015 12:32:13 -0700	[thread overview]
Message-ID: <566F193D.80403@wwwdotorg.org> (raw)
In-Reply-To: <1449708895-25695-1-git-send-email-trini@konsulko.com>

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;

  reply	other threads:[~2015-12-14 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  0:54 [U-Boot] [PATCH] fs: ext4: Remove ext4fs_free_node() Tom Rini
2015-12-14 19:32 ` Stephen Warren [this message]
2015-12-14 19:56   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566F193D.80403@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.