From: Andreas Schwab <schwab@suse.de>
To: Joseph Faulls <Joseph.Faulls@imgtec.com>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>,
"nelson@rivosinc.com" <nelson@rivosinc.com>,
"palmer@rivosinc.com" <palmer@rivosinc.com>
Subject: Re: [PATCH] bfd: check for truncation with R_RISCV_32 relocations
Date: Wed, 31 Jan 2024 10:14:20 +0100 [thread overview]
Message-ID: <mvmh6it985v.fsf@suse.de> (raw)
In-Reply-To: <LO4P265MB59148A03F40658E472D79B60807D2@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM> (Joseph Faulls's message of "Tue, 30 Jan 2024 18:21:25 +0000")
On Jan 30 2024, Joseph Faulls wrote:
> diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
> index 8b27e3b8d6a..975b40e5f53 100644
> --- a/bfd/elfnn-riscv.c
> +++ b/bfd/elfnn-riscv.c
> @@ -1865,6 +1865,9 @@ perform_relocation (const reloc_howto_type *howto,
> }
>
> case R_RISCV_32:
> + if (value & ~howto->dst_mask)
> + return bfd_reloc_overflow;
> + break;
The overflow check belongs to the howto table.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
prev parent reply other threads:[~2024-01-31 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 18:21 Joseph Faulls
2024-01-30 23:38 ` Nelson Chu
2024-01-31 14:08 ` Joseph Faulls
2024-02-21 11:02 ` Joseph Faulls
2024-01-31 9:14 ` Andreas Schwab [this message]
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=mvmh6it985v.fsf@suse.de \
--to=schwab@suse.de \
--cc=Joseph.Faulls@imgtec.com \
--cc=binutils@sourceware.org \
--cc=nelson@rivosinc.com \
--cc=palmer@rivosinc.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).