This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fixed issue with NULL pointer access on header var.
- From: Nick Clifton <nickc at redhat dot com>
- To: Cupertino dot Miranda at synopsys dot com, binutils at sourceware dot org
- Cc: Claudiu dot Zissulescu at synopsys dot com, Francois dot Bedard at synopsys dot com
- Date: Tue, 30 Aug 2016 14:16:41 +0100
- Subject: Re: [PATCH] Fixed issue with NULL pointer access on header var.
- Authentication-results: sourceware.org; auth=none
- References: <20160829100650.6767-1-cmiranda@synopsys.com>
Hi Cupertino,
> Variable "header" in function is set conditionally, but was accessed without
> verifying if pointer was NULL.
>
> opcodes/ChangeLog:
>
> Cupertino Miranda <cmiranda@synopsys.com>
> * opcodes/arc-dis.c (print_insn_arc): Changed.
Approved, please apply, but ...
> case bfd_mach_arc_arcv2:
> default:
> isa_mask = ARC_OPCODE_ARCv2EM;
> - if ((header->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_ARCV2HS)
> + if (header != NULL
> + && (header->e_flags & EF_ARC_MACH_MSK) == EF_ARC_CPU_ARCV2HS)
> {
> isa_mask = ARC_OPCODE_ARCv2HS;
> /* FPU instructions are not extensions for HS. */
Given that 'header' is only ever used in this particular case, why
not move the declaration and initialisation of header here as well ?
Cheers
Nick