linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()
@ 2022-11-04  3:16 Deming Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Deming Wang @ 2022-11-04  3:16 UTC (permalink / raw)
  To: viro
  Cc: ebiederm, keescook, linux-fsdevel, linux-mm, linux-kernel, Deming Wang

Avoid typecasts that are needed for IS_ERR() and use IS_ERR_VALUE()
instead.

Signed-off-by: Deming Wang <wangdeming@inspur.com>
---
 fs/binfmt_elf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 528e2ac8931f..d9af34f816a9 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1160,7 +1160,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
 				elf_prot, elf_flags, total_size);
 		if (BAD_ADDR(error)) {
-			retval = IS_ERR((void *)error) ?
+			retval = IS_ERR_VALUE(error) ?
 				PTR_ERR((void*)error) : -EINVAL;
 			goto out_free_dentry;
 		}
@@ -1245,7 +1245,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 					    interpreter,
 					    load_bias, interp_elf_phdata,
 					    &arch_state);
-		if (!IS_ERR((void *)elf_entry)) {
+		if (!IS_ERR_VALUE(elf_entry)) {
 			/*
 			 * load_elf_interp() returns relocation
 			 * adjustment
@@ -1254,7 +1254,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			elf_entry += interp_elf_ex->e_entry;
 		}
 		if (BAD_ADDR(elf_entry)) {
-			retval = IS_ERR((void *)elf_entry) ?
+			retval = IS_ERR_VALUE(elf_entry) ?
 					(int)elf_entry : -EINVAL;
 			goto out_free_dentry;
 		}
-- 
2.27.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()
  2022-11-15  3:17 Bo Liu
@ 2022-11-17 23:12 ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-11-17 23:12 UTC (permalink / raw)
  To: liubo03
  Cc: Kees Cook, Al Viro, ebiederm, linux-fsdevel, linux-mm, linux-kernel

On Mon, 14 Nov 2022 22:17:57 -0500, Bo Liu wrote:
> Avoid typecasts that are needed for IS_ERR() and use IS_ERR_VALUE()
> instead.

Applied to for-next/execve, thanks!

[1/1] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()
      https://git.kernel.org/kees/c/dc64cc12bcd1

-- 
Kees Cook



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()
@ 2022-11-15  3:17 Bo Liu
  2022-11-17 23:12 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Bo Liu @ 2022-11-15  3:17 UTC (permalink / raw)
  To: viro, ebiederm, keescook; +Cc: linux-fsdevel, linux-mm, linux-kernel, Bo Liu

Avoid typecasts that are needed for IS_ERR() and use IS_ERR_VALUE()
instead.

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 fs/binfmt_elf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 528e2ac8931f..d9af34f816a9 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1160,7 +1160,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
 				elf_prot, elf_flags, total_size);
 		if (BAD_ADDR(error)) {
-			retval = IS_ERR((void *)error) ?
+			retval = IS_ERR_VALUE(error) ?
 				PTR_ERR((void*)error) : -EINVAL;
 			goto out_free_dentry;
 		}
@@ -1245,7 +1245,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 					    interpreter,
 					    load_bias, interp_elf_phdata,
 					    &arch_state);
-		if (!IS_ERR((void *)elf_entry)) {
+		if (!IS_ERR_VALUE(elf_entry)) {
 			/*
 			 * load_elf_interp() returns relocation
 			 * adjustment
@@ -1254,7 +1254,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			elf_entry += interp_elf_ex->e_entry;
 		}
 		if (BAD_ADDR(elf_entry)) {
-			retval = IS_ERR((void *)elf_entry) ?
+			retval = IS_ERR_VALUE(elf_entry) ?
 					(int)elf_entry : -EINVAL;
 			goto out_free_dentry;
 		}
-- 
2.27.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-17 23:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  3:16 [PATCH] binfmt_elf: replace IS_ERR() with IS_ERR_VALUE() Deming Wang
2022-11-15  3:17 Bo Liu
2022-11-17 23:12 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox