linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement
@ 2019-09-11  4:54 Austin Kim
  2019-09-11  9:40 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 3+ messages in thread
From: Austin Kim @ 2019-09-11  4:54 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.

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

diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index deef17f..0921ce7 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -92,7 +92,7 @@ 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)) {
+		if (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",
 			       module->name, relindex, i, symname,
 			       rel->r_offset, dstsec->sh_size);
-- 
2.6.2


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

* Re: [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement
  2019-09-11  4:54 [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement Austin Kim
@ 2019-09-11  9:40 ` Russell King - ARM Linux admin
  2019-09-11 11:42   ` Austin Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux admin @ 2019-09-11  9:40 UTC (permalink / raw)
  To: Austin Kim
  Cc: allison, info, matthias.schiffer, linux-arm-kernel, linux-kernel

On Wed, Sep 11, 2019 at 01:54:08PM +0900, Austin Kim wrote:
> 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.
> 
> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
>  arch/arm/kernel/module.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> index deef17f..0921ce7 100644
> --- a/arch/arm/kernel/module.c
> +++ b/arch/arm/kernel/module.c
> @@ -92,7 +92,7 @@ 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)) {
> +		if (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",

Also change %d to %u here.

>  			       module->name, relindex, i, symname,
>  			       rel->r_offset, dstsec->sh_size);
> -- 
> 2.6.2
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

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

2019년 9월 11일 (수) 오후 6:40, Russell King - ARM Linux admin
<linux@armlinux.org.uk>님이 작성:
>
> On Wed, Sep 11, 2019 at 01:54:08PM +0900, Austin Kim wrote:
> > 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.
> >
> > Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> > ---
> >  arch/arm/kernel/module.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> > index deef17f..0921ce7 100644
> > --- a/arch/arm/kernel/module.c
> > +++ b/arch/arm/kernel/module.c
> > @@ -92,7 +92,7 @@ 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)) {
> > +             if (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",
>
> Also change %d to %u here.

Let me resend the patch with the change(%d to %u).

Thanks,
Austin Kim

>
> >                              module->name, relindex, i, symname,
> >                              rel->r_offset, dstsec->sh_size);
> > --
> > 2.6.2
> >
> >
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
> According to speedtest.net: 11.9Mbps down 500kbps up

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  4:54 [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement Austin Kim
2019-09-11  9:40 ` Russell King - ARM Linux admin
2019-09-11 11:42   ` Austin Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).