lkml.org 
[lkml]   [2017]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 1/3] xattr: add simple initxattrs function
> +/*
> + * 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.

\
 
 \ /
  Last update: 2017-01-08 10:56    [W:0.233 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site