@@ -667,11 +667,6 @@ xfs_fsverity_read_merkle(
if (error)
goto out_new_mk;
- if (!args.valuelen) {
- error = -ENODATA;
- goto out_new_mk;
- }
-
mk = xfs_fsverity_cache_store(ip, key, new_mk);
if (mk != new_mk) {
/*
@@ -722,6 +717,12 @@ xfs_fsverity_write_merkle(
.value = (void *)buf,
.valuelen = size,
};
+ const char *p = buf + size - 1;
+
+ /* Don't store trailing zeroes. */
+ while (p >= (const char *)buf && *p == 0)
+ p--;
+ args.valuelen = p - (const char *)buf + 1;
xfs_fsverity_init_merkle_args(ip, &name, pos, &args);
return xfs_attr_setname(&args, false);