From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Austin Kim <austindh.kim@gmail.com>
Cc: matthias.schiffer@ew.tq-group.com, info@metux.net,
linux-arm-kernel@lists.infradead.org, allison@lohutok.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement
Date: Wed, 11 Sep 2019 10:40:32 +0100 [thread overview]
Message-ID: <20190911094031.GU13294@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190911045408.GA62424@LGEARND20B15>
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Austin Kim <austindh.kim@gmail.com>
Cc: allison@lohutok.net, info@metux.net,
matthias.schiffer@ew.tq-group.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement
Date: Wed, 11 Sep 2019 10:40:32 +0100 [thread overview]
Message-ID: <20190911094031.GU13294@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190911045408.GA62424@LGEARND20B15>
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
next prev parent reply other threads:[~2019-09-11 9:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 4:54 [PATCH] ARM: module: Drop 'rel->r_offset < 0' always false statement Austin Kim
2019-09-11 4:54 ` Austin Kim
2019-09-11 9:40 ` Russell King - ARM Linux admin [this message]
2019-09-11 9:40 ` Russell King - ARM Linux admin
2019-09-11 11:42 ` Austin Kim
2019-09-11 11:42 ` Austin Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190911094031.GU13294@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=allison@lohutok.net \
--cc=austindh.kim@gmail.com \
--cc=info@metux.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.schiffer@ew.tq-group.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.