[gas/ARM] Fix NULL dereference of march_ext_opt

Message ID 2f40064c-5f8b-e13d-4683-5a4fd0175a9f@foss.arm.com
State New
Headers show
Series
  • [gas/ARM] Fix NULL dereference of march_ext_opt
Related show

Commit Message

Thomas Preudhomme March 2, 2018, 10:47 a.m.
Hi,

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.

ChangeLog entry is as follows:

*** gas/ChangeLog ***

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.

Committed as obvious.

Best regards,

Thomas

Patch

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index ac403cc74e9871721f1b522239997241eddefb4f..eda989092169ac8c977bbb36f4d151a85bf6ea60 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -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;