ARM: 8051/1: put_user: fix possible data corruption in put_user
[linux/fpc-iii.git] / fs / reiserfs / xattr_user.c
blob6ac8a8c8bd9cd1052055c1269006c4a62ccbc9cc
1 #include "reiserfs.h"
2 #include <linux/errno.h>
3 #include <linux/fs.h>
4 #include <linux/pagemap.h>
5 #include <linux/xattr.h>
6 #include "xattr.h"
7 #include <linux/uaccess.h>
9 static int
10 user_get(const struct xattr_handler *handler, struct dentry *dentry,
11 const char *name, void *buffer, size_t size)
13 if (!reiserfs_xattrs_user(dentry->d_sb))
14 return -EOPNOTSUPP;
15 return reiserfs_xattr_get(d_inode(dentry),
16 xattr_full_name(handler, name),
17 buffer, size);
20 static int
21 user_set(const struct xattr_handler *handler, struct dentry *dentry,
22 const char *name, const void *buffer, size_t size, int flags)
24 if (!reiserfs_xattrs_user(dentry->d_sb))
25 return -EOPNOTSUPP;
26 return reiserfs_xattr_set(d_inode(dentry),
27 xattr_full_name(handler, name),
28 buffer, size, flags);
31 static size_t user_list(const struct xattr_handler *handler,
32 struct dentry *dentry, char *list, size_t list_size,
33 const char *name, size_t name_len)
35 const size_t len = name_len + 1;
37 if (!reiserfs_xattrs_user(dentry->d_sb))
38 return 0;
39 if (list && len <= list_size) {
40 memcpy(list, name, name_len);
41 list[name_len] = '\0';
43 return len;
46 const struct xattr_handler reiserfs_xattr_user_handler = {
47 .prefix = XATTR_USER_PREFIX,
48 .get = user_get,
49 .set = user_set,
50 .list = user_list,