public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][GAS] RISC-V: Fix missing initialization of riscv_csr_extra structs
@ 2020-05-27 16:34 Simon Cook
  2020-05-27 23:49 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Cook @ 2020-05-27 16:34 UTC (permalink / raw)
  To: binutils

The next pointer of struct riscv_csr_extra was not always initilized
to NULL or a valid pointer, causing the assembler to attempt to read
through an uninitialized pointer on startup.

gas/ChangeLog:

        * config/tc-riscv.c (riscv_init_csr_hash): NULL initilize next
        pointer when creating struct riscv_csr_extra.
---
 gas/config/tc-riscv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 2a03a440b1..da94b5b1cf 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -695,6 +695,7 @@ riscv_init_csr_hash (const char *name,
   entry->address = address;
   entry->define_version = define_version;
   entry->abort_version = abort_version;
+  entry->next = NULL;

   /* If the CSR hasn't been inserted in the hash table, then insert it.
      Otherwise, attach the extra information to the entry which is already
-- 
2.17.1

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

end of thread, other threads:[~2020-05-28  1:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 16:34 [PATCH][GAS] RISC-V: Fix missing initialization of riscv_csr_extra structs Simon Cook
2020-05-27 23:49 ` Jim Wilson
2020-05-28  1:01   ` Nelson Chu

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).