[ARM] Fix NULL dereference of march_ext_opt
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Fri, 2 Mar 2018 10:46:32 +0000 (10:46 +0000)
committerThomas Preud'homme <thomas.preudhomme@arm.com>
Fri, 2 Mar 2018 10:47:14 +0000 (10:47 +0000)
Commit 4d354d8b8932d450c77fd52f3501662827523014 introduced a NULL
pointer dereference by replacing a pointer assignment by a pointer
dereference assignment without adding a NULL pointer check. This patch
fixes it.

2018-03-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (md_begin): Add NULL pointer check before
dereferencing march_ext_opt.

gas/ChangeLog
gas/config/tc-arm.c

index 46711fd5fe95b7b62593f3bc3bcac14871eb1647..d8f5892711176449ece923be871be5dfb00f0776 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-02  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * config/tc-arm.c (md_begin): Add NULL pointer check before
+       dereferencing march_ext_opt.
+
 2018-03-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * config/tc-arm.c (cpu_variant, arm_arch_used, thumb_arch_used,
index ac403cc74e9871721f1b522239997241eddefb4f..eda989092169ac8c977bbb36f4d151a85bf6ea60 100644 (file)
@@ -25407,7 +25407,7 @@ md_begin (void)
         from the processor.  */
       if (mcpu_fpu_opt)
        selected_fpu = *mcpu_fpu_opt;
-      else
+      else if (march_fpu_opt)
        selected_fpu = *march_fpu_opt;
 #else
       selected_fpu = fpu_default;