Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1553821
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 1/3] xattr: add simple initxattrs function |
| Date | 2017-01-08 11:00 +0100 |
| Message-ID | <sXiqB-4GJ-23@gated-at.bofh.it> (permalink) |
| References | <sWooq-BR-25@gated-at.bofh.it> <sWoy5-G2-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> +/*
> + * Callback for security_inode_init_security() for acquiring xattrs.
> + */
> +int simple_xattr_initxattrs(struct inode *inode,
> + const struct xattr *xattr_array,
> + void *fs_info)
> +{
> + struct simple_xattrs *xattrs;
> + const struct xattr *xattr;
> + struct simple_xattr *new_xattr;
> + size_t len;
> +
> + if (!fs_info)
> + return -ENOMEM;
This probablt should be an EINVAL, and also a WARN_ON_ONCE.
> + xattrs = (struct simple_xattrs *) fs_info;
No need for the cast. In fact we should probably just declarate it
as struct simple_xattrs *xattrs in the protoype and thus be type safe.
> +
> + for (xattr = xattr_array; xattr->name != NULL; xattr++) {
> + new_xattr = simple_xattr_alloc(xattr->value, xattr->value_len);
> + if (!new_xattr)
> + return -ENOMEM;
We'll need to unwind the previous allocations here.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 1/3] xattr: add simple initxattrs function David Graziano <david.graziano@rockwellcollins.com> - 2017-01-05 23:20 +0100
Re: [PATCH v4 1/3] xattr: add simple initxattrs function Christoph Hellwig <hch@infradead.org> - 2017-01-08 11:00 +0100
Re: [PATCH v4 1/3] xattr: add simple initxattrs function David Graziano <david.graziano@rockwellcollins.com> - 2017-01-09 16:50 +0100
csiph-web