null dereference in csky opcodes support

Message ID ab9yzeNBsL2Tmeyw@squeak.grove.modra.org
State New
Headers
Series null dereference in csky opcodes support |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Alan Modra March 22, 2026, 4:40 a.m. UTC
  section->relocation will remain NULL on an error reading the relocs.

	* csky-dis.c (is_extern_symbol): Delete section flag check.
	Instead check that section->relocation is non-NULL.  Make addr
	param a bfd_vma.
  

Patch

diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index aaf6ffd1b85..6c905833cce 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -201,19 +201,15 @@  csky_find_inst_info (struct csky_opcode_info const **pinfo,
 }
 
 static bool
-is_extern_symbol (struct disassemble_info *info, int addr)
+is_extern_symbol (struct disassemble_info *info, bfd_vma addr)
 {
-  unsigned int rel_count = 0;
-
-  if (info->section == NULL)
-    return 0;
-  if ((info->section->flags & SEC_RELOC) != 0)	/* Fit .o file.  */
+  if (info->section != NULL && info->section->relocation != NULL)
     {
+      unsigned int rel_count = 0;
       struct reloc_cache_entry *pt = info->section->relocation;
       for (; rel_count < info->section->reloc_count; rel_count++, pt++)
-	if ((long unsigned int)addr == pt->address)
+	if (addr == pt->address)
 	  return true;
-      return false;
     }
   return false;
 }