fix: handle fp invalid err

Signed-off-by: Hongjin Li <lihongjin1@huawei.com>
This commit is contained in:
Hongjin Li
2023-11-13 12:12:30 +08:00
parent 8ad4fe1963
commit 6b8a5320d0
+4 -4
View File
@@ -173,16 +173,16 @@ int elf_file_enable_fs_verity(struct file *file)
}
int err = 0;
char *real_path = file_path(file, path_buf, PATH_MAX - 1);
if (!real_path) {
if (IS_ERR_OR_NULL(real_path)) {
code_sign_log_error("get file path failed");
err = -EFAULT;
err = -ENOENT;
goto release_path_buf_out;
}
struct file *fp = filp_open(real_path, O_RDONLY, 0);
if (!fp) {
if (IS_ERR(fp)) {
code_sign_log_error("filp_open failed");
err = -EFAULT;
err = PTR_ERR(fp);
goto release_path_buf_out;
}
struct inode *inode = file_inode(fp);