summaryrefslogtreecommitdiffstats
path: root/fs/verity/enable.c
diff options
context:
space:
mode:
authorZhang Jianhua <chris.zjh@huawei.com>2022-05-19 04:24:50 +0200
committerEric Biggers <ebiggers@google.com>2022-05-19 18:53:33 +0200
commite6af1bb07704b53bad7771db1b05ee17abad11cb (patch)
treebc3ee992ac54d191b2144094da1029aab6bf564a /fs/verity/enable.c
parentfs-verity: remove unused parameter desc_size in fsverity_create_info() (diff)
downloadlinux-e6af1bb07704b53bad7771db1b05ee17abad11cb.tar.xz
linux-e6af1bb07704b53bad7771db1b05ee17abad11cb.zip
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
Diffstat (limited to 'fs/verity/enable.c')
-rw-r--r--fs/verity/enable.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/verity/enable.c b/fs/verity/enable.c
index 0f953bae1747..d52872c808ff 100644
--- a/fs/verity/enable.c
+++ b/fs/verity/enable.c
@@ -202,7 +202,7 @@ static int enable_verity(struct file *filp,
const struct fsverity_operations *vops = inode->i_sb->s_vop;
struct merkle_tree_params params = { };
struct fsverity_descriptor *desc;
- size_t desc_size = sizeof(*desc) + arg->sig_size;
+ size_t desc_size = struct_size(desc, signature, arg->sig_size);
struct fsverity_info *vi;
int err;