PR27630, ubsan: elf32-arm.c:6587:20

Message ID 20210414090218.GN5425@bubble.grove.modra.org
State New
Headers show
Series
  • PR27630, ubsan: elf32-arm.c:6587:20
Related show

Commit Message

Luis Machado via Binutils April 14, 2021, 9:02 a.m.
Fix a mostly useless complaint from ubsan.

	PR 27630
	* elf32-arm.c (elf32_arm_size_stubs): Don't use &hash->root when
	hash might be NULL, cast instead.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 29656a7ab63..81667ea090d 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6582,8 +6582,9 @@  elf32_arm_size_stubs (bfd *output_bfd,
 		      && (r_type != (unsigned int) R_ARM_PLT32)
 		      && !((r_type == (unsigned int) R_ARM_TLS_CALL
 			    || r_type == (unsigned int) R_ARM_THM_TLS_CALL)
-			   && r_type == elf32_arm_tls_transition
-			       (info, r_type, &hash->root)
+			   && r_type == (elf32_arm_tls_transition
+					 (info, r_type,
+					  (struct elf_link_hash_entry *) hash))
 			   && ((hash ? hash->tls_type
 				: (elf32_arm_local_got_tls_type
 				   (input_bfd)[r_indx]))