Skip to content

Commit e6af1bb

Browse files
Zhang Jianhuaebiggers
authored andcommitted
fs-verity: Use struct_size() helper in enable_verity()
Follow the best practice for allocating a variable-sized structure. Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com> [ebiggers: adjusted commit message] Signed-off-by: Eric Biggers <ebiggers@google.com> Link: https://lore.kernel.org/r/20220519022450.2434483-1-chris.zjh@huawei.com
1 parent b0487ed commit e6af1bb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/verity/enable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int enable_verity(struct file *filp,
202202
const struct fsverity_operations *vops = inode->i_sb->s_vop;
203203
struct merkle_tree_params params = { };
204204
struct fsverity_descriptor *desc;
205-
size_t desc_size = sizeof(*desc) + arg->sig_size;
205+
size_t desc_size = struct_size(desc, signature, arg->sig_size);
206206
struct fsverity_info *vi;
207207
int err;
208208

0 commit comments

Comments
 (0)