Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1578809 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-02-10 22:20 +0100 |
| Last post | 2017-02-11 12:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] ovl: Avoid some memory allocation Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-10 22:20 +0100
Re: [PATCH] ovl: Avoid some memory allocation walter harms <wharms@bfs.de> - 2017-02-11 12:10 +0100
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-02-10 22:20 +0100 |
| Subject | [PATCH] ovl: Avoid some memory allocation |
| Message-ID | <t9qLL-ko-11@gated-at.bofh.it> |
Reorder code to avoid allocating and then freeing some memory in an error handling path. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- fs/overlayfs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 023bb0b03352..ba80ebb8a104 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -35,13 +35,13 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, return 0; goto fail; } + if (res == 0) + goto invalid; + buf = kzalloc(prelen + res + strlen(post) + 1, GFP_TEMPORARY); if (!buf) return -ENOMEM; - if (res == 0) - goto invalid; - res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); if (res < 0) goto fail; -- 2.9.3
[toc] | [next] | [standalone]
| From | walter harms <wharms@bfs.de> |
|---|---|
| Date | 2017-02-11 12:10 +0100 |
| Message-ID | <t9DJ0-8oW-11@gated-at.bofh.it> |
| In reply to | #1578809 |
Am 10.02.2017 22:18, schrieb Christophe JAILLET: > Reorder code to avoid allocating and then freeing some memory in an error > handling path. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > fs/overlayfs/namei.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c > index 023bb0b03352..ba80ebb8a104 100644 > --- a/fs/overlayfs/namei.c > +++ b/fs/overlayfs/namei.c > @@ -35,13 +35,13 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d, > return 0; > goto fail; > } > + if (res == 0) > + goto invalid; > + perhaps: if (res == -ENODATA || res == -EOPNOTSUPP) return 0; if (ret < 0) goto fail; if (ret == 0) goto invalid; I think its better to read, i guess the author also as we can find this pattern after the other vfs_getxattr() also. re, wh > buf = kzalloc(prelen + res + strlen(post) + 1, GFP_TEMPORARY); > if (!buf) > return -ENOMEM; > > - if (res == 0) > - goto invalid; > - > res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res); > if (res < 0) > goto fail;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web