From: Fabian Frederick <fabf@skynet.be>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2 linux-next] FS/HFSPLUS: move xattr_name allocation in hfsplus_setxattr()
Date: Tue, 3 Mar 2015 19:04:25 +0100 (CET) [thread overview]
Message-ID: <1799681970.788684.1425405865299.open-xchange@webmail.nmp.proximus.be> (raw)
In-Reply-To: <20150302142531.038da6eafe388aa96a83f1a3@linux-foundation.org>
> On 02 March 2015 at 23:25 Andrew Morton <akpm@linux-foundation.org> wrote:
>
>
> On Fri, 27 Feb 2015 18:38:26 +0100 Fabian Frederick <fabf@skynet.be> wrote:
>
> > security/trusted/user/osx setxattr did the same
> > xattr_name initialization. Move that operation in hfsplus_setxattr().
> >
> > Tested with security/trusted/user getfattr/setfattr
> >
> > --- a/fs/hfsplus/xattr.c
> > +++ b/fs/hfsplus/xattr.c
> > @@ -424,6 +424,28 @@ static int copy_name(char *buffer, const char
> > *xattr_name, int name_len)
> > return len;
> > }
> >
> > +int hfsplus_setxattr(struct dentry *dentry, const char *name,
> > + const void *value, size_t size, int flags,
> > + const char *prefix, size_t prefixlen)
> > +{
> > + char *xattr_name;
> > + int res;
> > +
> > + if (!strcmp(name, ""))
> > + return -EINVAL;
> > +
> > + xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1,
> > + GFP_KERNEL);
> > + if (!xattr_name)
> > + return -ENOMEM;
> > + strcpy(xattr_name, prefix);
> > + strcpy(xattr_name + prefixlen, name);
>
> Can we use kasprintf(GFP_KERNEL, "%s%s", prefix, name) and zap `prefixlen'?
Of course :) Thanks Andrew, I'll send a small patchset for relevant filesystems.
Regards,
Fabian
>
> > + res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size,
> > + flags);
> > + kfree(xattr_name);
> > + return res;
> > +}
>
prev parent reply other threads:[~2015-03-03 18:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 17:38 [PATCH 2/2 linux-next] FS/HFSPLUS: move xattr_name allocation in hfsplus_setxattr() Fabian Frederick
2015-03-02 22:25 ` Andrew Morton
2015-03-03 18:04 ` Fabian Frederick [this message]
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=1799681970.788684.1425405865299.open-xchange@webmail.nmp.proximus.be \
--to=fabf@skynet.be \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).