All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement
@ 2019-09-11 14:15 ` Austin Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Austin Kim @ 2019-09-11 14:15 UTC (permalink / raw)
  To: linux, allison, info, matthias.schiffer
  Cc: linux-arm-kernel, linux-kernel, austindh.kim

Since rel->r_offset is declared as Elf32_Addr,
this value is always non-negative.
typedef struct elf32_rel {
  Elf32_Addr    r_offset;
  Elf32_Word  r_info;
} Elf32_Rel;

typedef __u32   Elf32_Addr;
typedef unsigned int __u32;

Drop 'rel->r_offset < 0' statement which is always false.
Also change %u to %d in pr_err() for rel->r_offset.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 arch/arm/kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index deef17f34..f805bcbda 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -92,8 +92,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
 		sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
 		symname = strtab + sym->st_name;
 
-		if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
-			pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n",
+		if (rel->r_offset > dstsec->sh_size - sizeof(u32)) {
+			pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %u size %u\n",
 			       module->name, relindex, i, symname,
 			       rel->r_offset, dstsec->sh_size);
 			return -ENOEXEC;
-- 
2.11.0


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

* [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement
@ 2019-09-11 14:15 ` Austin Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Austin Kim @ 2019-09-11 14:15 UTC (permalink / raw)
  To: linux, allison, info, matthias.schiffer
  Cc: austindh.kim, linux-kernel, linux-arm-kernel

Since rel->r_offset is declared as Elf32_Addr,
this value is always non-negative.
typedef struct elf32_rel {
  Elf32_Addr    r_offset;
  Elf32_Word  r_info;
} Elf32_Rel;

typedef __u32   Elf32_Addr;
typedef unsigned int __u32;

Drop 'rel->r_offset < 0' statement which is always false.
Also change %u to %d in pr_err() for rel->r_offset.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 arch/arm/kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index deef17f34..f805bcbda 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -92,8 +92,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
 		sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
 		symname = strtab + sym->st_name;
 
-		if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
-			pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n",
+		if (rel->r_offset > dstsec->sh_size - sizeof(u32)) {
+			pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %u size %u\n",
 			       module->name, relindex, i, symname,
 			       rel->r_offset, dstsec->sh_size);
 			return -ENOEXEC;
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement
  2019-09-11 14:15 ` Austin Kim
@ 2019-09-15 22:21   ` Austin Kim
  -1 siblings, 0 replies; 4+ messages in thread
From: Austin Kim @ 2019-09-15 22:21 UTC (permalink / raw)
  To: Russell King - ARM Linux admin, allison, info, matthias.schiffer
  Cc: linux-arm-kernel, linux-kernel

Hello, Maintainer(Russell King)...
Would you please update the feedback for this patch?

2019년 9월 11일 (수) 오후 11:16, Austin Kim <austindh.kim@gmail.com>님이 작성:
>
> Since rel->r_offset is declared as Elf32_Addr,
> this value is always non-negative.
> typedef struct elf32_rel {
>   Elf32_Addr    r_offset;
>   Elf32_Word  r_info;
> } Elf32_Rel;
>
> typedef __u32   Elf32_Addr;
> typedef unsigned int __u32;
>
> Drop 'rel->r_offset < 0' statement which is always false.
> Also change %u to %d in pr_err() for rel->r_offset.
>
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
>  arch/arm/kernel/module.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> index deef17f34..f805bcbda 100644
> --- a/arch/arm/kernel/module.c
> +++ b/arch/arm/kernel/module.c
> @@ -92,8 +92,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
>                 sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
>                 symname = strtab + sym->st_name;
>
> -               if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
> -                       pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n",
> +               if (rel->r_offset > dstsec->sh_size - sizeof(u32)) {
> +                       pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %u size %u\n",
>                                module->name, relindex, i, symname,
>                                rel->r_offset, dstsec->sh_size);
>                         return -ENOEXEC;
> --
> 2.11.0
>

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

* Re: [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement
@ 2019-09-15 22:21   ` Austin Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Austin Kim @ 2019-09-15 22:21 UTC (permalink / raw)
  To: Russell King - ARM Linux admin, allison, info, matthias.schiffer
  Cc: linux-kernel, linux-arm-kernel

Hello, Maintainer(Russell King)...
Would you please update the feedback for this patch?

2019년 9월 11일 (수) 오후 11:16, Austin Kim <austindh.kim@gmail.com>님이 작성:
>
> Since rel->r_offset is declared as Elf32_Addr,
> this value is always non-negative.
> typedef struct elf32_rel {
>   Elf32_Addr    r_offset;
>   Elf32_Word  r_info;
> } Elf32_Rel;
>
> typedef __u32   Elf32_Addr;
> typedef unsigned int __u32;
>
> Drop 'rel->r_offset < 0' statement which is always false.
> Also change %u to %d in pr_err() for rel->r_offset.
>
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
>  arch/arm/kernel/module.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> index deef17f34..f805bcbda 100644
> --- a/arch/arm/kernel/module.c
> +++ b/arch/arm/kernel/module.c
> @@ -92,8 +92,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
>                 sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
>                 symname = strtab + sym->st_name;
>
> -               if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
> -                       pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n",
> +               if (rel->r_offset > dstsec->sh_size - sizeof(u32)) {
> +                       pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %u size %u\n",
>                                module->name, relindex, i, symname,
>                                rel->r_offset, dstsec->sh_size);
>                         return -ENOEXEC;
> --
> 2.11.0
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-09-15 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 14:15 [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement Austin Kim
2019-09-11 14:15 ` Austin Kim
2019-09-15 22:21 ` Austin Kim
2019-09-15 22:21   ` Austin Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.