This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_31-branch] Fix a compile time warning building the AArch64 BFD backend.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a45c28e35832097f27e3458f115cfb1e1bd7cf47

commit a45c28e35832097f27e3458f115cfb1e1bd7cf47
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Jun 25 12:51:10 2018 +0100

    Fix a compile time warning building the AArch64 BFD backend.
    
    	* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
    	for malloc returning NULL.
    	(_bfd_aarch64_erratum_843419_fixup): Check for
    	_bfd_aarch64_erratum_835769_stub_name returning NULL.

Diff:
---
 bfd/ChangeLog       | 7 +++++++
 bfd/elfnn-aarch64.c | 8 +++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a95f126..5e6dec9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2018-06-25  Nick Clifton  <nickc@redhat.com>
+
+	* elfnn-aarch64.c (_bfd_aarch64_erratum_835769_stub_name): Check
+	for malloc returning NULL.
+	(_bfd_aarch64_erratum_843419_fixup): Check for
+	_bfd_aarch64_erratum_835769_stub_name returning NULL.
+
 2018-06-24  Nick Clifton  <nickc@redhat.com>
 
 	* version.m4 (BFD_VERSION): Update to 2.30.90.
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 3ccca77..cf321f3 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3745,7 +3745,8 @@ _bfd_aarch64_erratum_835769_stub_name (unsigned num_fixes)
 {
   char *stub_name = (char *) bfd_malloc
     (strlen ("__erratum_835769_veneer_") + 16);
-  sprintf (stub_name,"__erratum_835769_veneer_%d", num_fixes);
+  if (stub_name != NULL)
+    sprintf (stub_name,"__erratum_835769_veneer_%d", num_fixes);
   return stub_name;
 }
 
@@ -3992,6 +3993,8 @@ _bfd_aarch64_erratum_843419_fixup (uint32_t insn,
   struct elf_aarch64_stub_hash_entry *stub_entry;
 
   stub_name = _bfd_aarch64_erratum_843419_stub_name (section, ldst_offset);
+  if (stub_name == NULL)
+    return FALSE;
   stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table, stub_name,
 					 FALSE, FALSE);
   if (stub_entry)
@@ -4009,8 +4012,7 @@ _bfd_aarch64_erratum_843419_fixup (uint32_t insn,
      If we placed workaround veneers in any other stub section then we
      could not assume that all relocations have been processed on the
      corresponding input section at the point we output the stub
-     section.
-   */
+     section.  */
 
   stub_entry = _bfd_aarch64_add_stub_entry_after (stub_name, section, htab);
   if (stub_entry == NULL)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]