On Fri, 2021-09-24 at 19:16 +0300, Konstantin Komarov wrote:
Make code more readable.
Don't try to read zero bytes.
Add warning when size of exteneded attribute exceeds limit.
[]
quoted hunk ↗ jump to hunk
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
[]
quoted hunk ↗ jump to hunk
@@ -366,21 +368,22 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,
[]
+ ea_info.size = cpu_to_le32(size);
+
+ /*
+ * 1. Check ea_info.size_pack for overflow.
+ * 2. New attibute size must fit value from $AttrDef
+ */
+ if (new_pack > 0xffff || size > sbi->ea_max_size) {
+ ntfs_inode_warn(
+ inode,
+ "The size of exteneded attributes must not exceed 64K");
trivial typo of extended. Pedants might suggest KiB.