Blame SOURCES/binutils-coverty-fixes.patch

58725c
--- binutils.orig/gold/aarch64.cc	2017-01-18 16:05:12.747684566 +0000
58725c
+++ binutils-2.27/gold/aarch64.cc	2017-01-18 16:05:23.128501011 +0000
58725c
@@ -784,8 +784,14 @@ Stub_template_repertoire<big_endian>::St
58725c
       0x14000000,    /* b <label> */
58725c
     };
58725c
 
58725c
-  // ST_E_835769 has the same stub template as ST_E_843419.
58725c
-  const static Insntype* ST_E_835769_INSNS = ST_E_843419_INSNS;
58725c
+  // ST_E_835769 has the same stub template as ST_E_843419
58725c
+  // but we reproduce the array here so that the sizeof
58725c
+  // expressions in install_insn_template will work.
58725c
+  const static Insntype ST_E_835769_INSNS[] =
58725c
+    {
58725c
+      0x00000000,    /* Placeholder for erratum insn. */
58725c
+      0x14000000,    /* b <label> */
58725c
+    };
58725c
 
58725c
 #define install_insn_template(T) \
58725c
   const static Stub_template<big_endian> template_##T = {  \
58725c
--- binutils.orig/gas/config/tc-i386.c	2017-01-18 16:05:12.533688350 +0000
58725c
+++ binutils-2.27/gas/config/tc-i386.c	2017-01-18 16:11:29.828016979 +0000
58725c
@@ -4120,13 +4120,13 @@ parse_operands (char *l, const char *mne
58725c
 	{			/* Yes, we've read in another operand.  */
58725c
 	  unsigned int operand_ok;
58725c
 	  this_operand = i.operands++;
58725c
-	  i.types[this_operand].bitfield.unspecified = 1;
58725c
 	  if (i.operands > MAX_OPERANDS)
58725c
 	    {
58725c
 	      as_bad (_("spurious operands; (%d operands/instruction max)"),
58725c
 		      MAX_OPERANDS);
58725c
 	      return NULL;
58725c
 	    }
58725c
+	  i.types[this_operand].bitfield.unspecified = 1;
58725c
 	  /* Now parse operand adding info to 'i' as we go along.  */
58725c
 	  END_STRING_AND_SAVE (l);
58725c
 
58725c
diff -rup binutils.orig/ld/testplug2.c binutils-2.27/ld/testplug2.c
58725c
--- binutils.orig/ld/testplug2.c	2017-01-18 16:05:12.777684035 +0000
58725c
+++ binutils-2.27/ld/testplug2.c	2017-01-18 16:18:39.437420563 +0000
58725c
@@ -242,10 +242,11 @@ parse_symdefstr (const char *str, struct
58725c
     sym->version = NULL;
58725c
   if (colon5 && colon5[1])
58725c
     {
58725c
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
58725c
+      ++colon5;
58725c
+      sym->comdat_key = malloc (strlen (colon5) + 1);
58725c
       if (!sym->comdat_key)
58725c
 	return LDPS_ERR;
58725c
-      strcpy (sym->comdat_key, colon5 + 1);
58725c
+      strcpy (sym->comdat_key, colon5);
58725c
     }
58725c
   else
58725c
     sym->comdat_key = 0;
58725c
diff -rup binutils.orig/ld/testplug3.c binutils-2.27/ld/testplug3.c
58725c
--- binutils.orig/ld/testplug3.c	2017-01-18 16:05:12.777684035 +0000
58725c
+++ binutils-2.27/ld/testplug3.c	2017-01-18 16:17:48.878314557 +0000
58725c
@@ -241,10 +241,11 @@ parse_symdefstr (const char *str, struct
58725c
     sym->version = NULL;
58725c
   if (colon5 && colon5[1])
58725c
     {
58725c
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
58725c
+      ++colon5;
58725c
+      sym->comdat_key = malloc (strlen (colon5) + 1);
58725c
       if (!sym->comdat_key)
58725c
 	return LDPS_ERR;
58725c
-      strcpy (sym->comdat_key, colon5 + 1);
58725c
+      strcpy (sym->comdat_key, colon5);
58725c
     }
58725c
   else
58725c
     sym->comdat_key = 0;
58725c
diff -rup binutils.orig/ld/testplug4.c binutils-2.27/ld/testplug4.c
58725c
--- binutils.orig/ld/testplug4.c	2017-01-18 16:05:12.777684035 +0000
58725c
+++ binutils-2.27/ld/testplug4.c	2017-01-18 16:16:34.751625275 +0000
58725c
@@ -242,10 +242,11 @@ parse_symdefstr (const char *str, struct
58725c
     sym->version = NULL;
58725c
   if (colon5 && colon5[1])
58725c
     {
58725c
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
58725c
+      ++colon5;
58725c
+      sym->comdat_key = malloc (strlen (colon5) + 1);
58725c
       if (!sym->comdat_key)
58725c
 	return LDPS_ERR;
58725c
-      strcpy (sym->comdat_key, colon5 + 1);
58725c
+      strcpy (sym->comdat_key, colon5);
58725c
     }
58725c
   else
58725c
     sym->comdat_key = 0;
58725c
diff -rup binutils.orig/ld/testplug.c binutils-2.27/ld/testplug.c
58725c
--- binutils.orig/ld/testplug.c	2017-01-18 16:05:12.777684035 +0000
58725c
+++ binutils-2.27/ld/testplug.c	2017-01-18 16:19:22.460659820 +0000
58725c
@@ -238,10 +238,11 @@ parse_symdefstr (const char *str, struct
58725c
     sym->version = NULL;
58725c
   if (colon5 && colon5[1])
58725c
     {
58725c
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
58725c
+      ++colon5;
58725c
+      sym->comdat_key = malloc (strlen (colon5) + 1);
58725c
       if (!sym->comdat_key)
58725c
 	return LDPS_ERR;
58725c
-      strcpy (sym->comdat_key, colon5 + 1);
58725c
+      strcpy (sym->comdat_key, colon5);
58725c
     }
58725c
   else
58725c
     sym->comdat_key = 0;