[Devel,RH7] pfcache: fix misplaced endline in ext4_xattr_trusted_csum_list

Submitted by Pavel Tikhomirov on Sept. 26, 2016, 12:53 p.m.

Details

Message ID 1474894434-20730-1-git-send-email-ptikhomirov@virtuozzo.com
State New
Series "pfcache: fix misplaced endline in ext4_xattr_trusted_csum_list"
Headers show

Commit Message

Pavel Tikhomirov Sept. 26, 2016, 12:53 p.m.
It is the fix for commit 00ebb1860eff ("pfcache: hide
trusted.pfcache from listxattr")

Else entries in list are not separated and getfattr fails:

getfattr -d -m trusted /vz/root/110/testfile
vz/root/110/testfile: trusted.pfcache�trusted.test: No such attribute

https://jira.sw.ru/browse/PSBM-52574
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 fs/ext4/pfcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/pfcache.c b/fs/ext4/pfcache.c
index 52bd886..256d2a7 100644
--- a/fs/ext4/pfcache.c
+++ b/fs/ext4/pfcache.c
@@ -776,7 +776,7 @@  ext4_xattr_trusted_csum_list(struct dentry *dentry, char *list, size_t list_size
 
 	if (list && len <= list_size) {
 		memcpy(list, XATTR_TRUSTED_CSUM_PREFIX, XATTR_TRUSTED_CSUM_PREFIX_LEN);
-		list[len] = '\0';
+		list[XATTR_TRUSTED_CSUM_PREFIX_LEN] = '\0';
 	}
 	return len;
 }

Comments

Kirill Tkhai Sept. 26, 2016, 1:21 p.m.
On 26.09.2016 15:53, Pavel Tikhomirov wrote:
> It is the fix for commit 00ebb1860eff ("pfcache: hide
> trusted.pfcache from listxattr")
> 
> Else entries in list are not separated and getfattr fails:
> 
> getfattr -d -m trusted /vz/root/110/testfile
> vz/root/110/testfile: trusted.pfcache�trusted.test: No such attribute
> 
> https://jira.sw.ru/browse/PSBM-52574
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  fs/ext4/pfcache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/pfcache.c b/fs/ext4/pfcache.c
> index 52bd886..256d2a7 100644
> --- a/fs/ext4/pfcache.c
> +++ b/fs/ext4/pfcache.c
> @@ -776,7 +776,7 @@ ext4_xattr_trusted_csum_list(struct dentry *dentry, char *list, size_t list_size
>  
>  	if (list && len <= list_size) {
>  		memcpy(list, XATTR_TRUSTED_CSUM_PREFIX, XATTR_TRUSTED_CSUM_PREFIX_LEN);
> -		list[len] = '\0';
> +		list[XATTR_TRUSTED_CSUM_PREFIX_LEN] = '\0';
>  	}
>  	return len;
>  }
>