public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Simon Cook <simon.cook@embecosm.com>
To: binutils@sourceware.org
Subject: [PATCH][GAS] RISC-V: Fix missing initialization of riscv_csr_extra structs
Date: Wed, 27 May 2020 17:34:58 +0100	[thread overview]
Message-ID: <f3da246c-8d87-a5dd-0828-a4777d033923@embecosm.com> (raw)

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

             reply	other threads:[~2020-05-27 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 16:34 Simon Cook [this message]
2020-05-27 23:49 ` Jim Wilson
2020-05-28  1:01   ` Nelson Chu

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=f3da246c-8d87-a5dd-0828-a4777d033923@embecosm.com \
    --to=simon.cook@embecosm.com \
    --cc=binutils@sourceware.org \
    /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).