On Fri, 27 Feb 2015 18:38:26 +0100 Fabian Frederick <f...@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'? > + res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size, > + flags); > + kfree(xattr_name); > + return res; > +} -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/