Fix extattr getters in case of neither uio nor buffer was not passed to VOP_*.
Approved by: pfg (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13359
This commit is contained in:
parent
155b183ad2
commit
1806c9ab85
@ -220,9 +220,10 @@ ext2_extattr_inode_list(struct inode *ip, int attrnamespace,
|
||||
return (ENOTSUP);
|
||||
}
|
||||
|
||||
if (uio == NULL)
|
||||
if (size != NULL)
|
||||
*size += name_len + 1;
|
||||
else {
|
||||
|
||||
if (uio != NULL) {
|
||||
char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
|
||||
name[0] = name_len;
|
||||
memcpy(&name[1], attr_name, name_len);
|
||||
@ -286,9 +287,10 @@ ext2_extattr_block_list(struct inode *ip, int attrnamespace,
|
||||
return (ENOTSUP);
|
||||
}
|
||||
|
||||
if (uio == NULL)
|
||||
if (size != NULL)
|
||||
*size += name_len + 1;
|
||||
else {
|
||||
|
||||
if (uio != NULL) {
|
||||
char *name = malloc(name_len + 1, M_TEMP, M_WAITOK);
|
||||
name[0] = name_len;
|
||||
memcpy(&name[1], attr_name, name_len);
|
||||
@ -361,12 +363,12 @@ ext2_extattr_inode_get(struct inode *ip, int attrnamespace,
|
||||
|
||||
if (strlen(name) == name_len &&
|
||||
0 == strncmp(attr_name, name, name_len)) {
|
||||
if (uio == NULL)
|
||||
if (size != NULL)
|
||||
*size += entry->e_value_size;
|
||||
else {
|
||||
|
||||
if (uio != NULL)
|
||||
error = uiomove(((char *)EXT2_IFIRST(header)) +
|
||||
entry->e_value_offs, entry->e_value_size, uio);
|
||||
}
|
||||
|
||||
brelse(bp);
|
||||
return (error);
|
||||
@ -428,12 +430,12 @@ ext2_extattr_block_get(struct inode *ip, int attrnamespace,
|
||||
|
||||
if (strlen(name) == name_len &&
|
||||
0 == strncmp(attr_name, name, name_len)) {
|
||||
if (uio == NULL)
|
||||
if (size != NULL)
|
||||
*size += entry->e_value_size;
|
||||
else {
|
||||
|
||||
if (uio != NULL)
|
||||
error = uiomove(bp->b_data + entry->e_value_offs,
|
||||
entry->e_value_size, uio);
|
||||
}
|
||||
|
||||
brelse(bp);
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user