From 2172cafe2792c378897f379dd7c3714175bb505e Mon Sep 17 00:00:00 2001 From: yeyuning Date: Mon, 19 Aug 2024 16:26:05 +0800 Subject: [PATCH] check pgtpeinfo off Signed-off-by: yeyuning Change-Id: I5b4570e7a57a788a24e2e63c0c6b03da34f133fd --- fs/verity/enable.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/verity/enable.c b/fs/verity/enable.c index 078d2fde21e4..4412f3f1b296 100644 --- a/fs/verity/enable.c +++ b/fs/verity/enable.c @@ -630,8 +630,9 @@ int fsverity_ioctl_enable_code_sign(struct file *filp, const void __user *uarg) if (arg.sig_size > FS_VERITY_MAX_SIGNATURE_SIZE) return -EMSGSIZE; - - if (arg.pgtypeinfo_off > arg.data_size - arg.pgtypeinfo_size) + + // when calc pgtypeinfo_size trans bit size to byte size + if (arg.pgtypeinfo_off > arg.data_size - arg.pgtypeinfo_size / 8) return -EINVAL; return check_file_and_enable_verity(filp, (struct fsverity_enable_arg *)&arg); -- Gitee