two patches for bugs in BFD/peXXigen.c

Andreas Schwab schwab@linux-m68k.org
Mon Sep 6 17:46:00 GMT 2010


Kai Tietz <ktietz70@googlemail.com> writes:

> 2010/9/6 Alan Modra <amodra@gmail.com>:
>> @@ -1860,12 +1855,14 @@ _bfd_XX_print_ce_compressed_pdata (bfd *
>>       if (tsection && coff_section_data (abfd, tsection)
>>          && pei_section_data (abfd, tsection))
>>        {
>> -         if (bfd_malloc_and_get_section (abfd, tsection, & tdata))
>> -           {
>>              int xx = (begin_addr - 8) - tsection->vma;
>> +         bfd_byte *tdata;
>>
>>              tdata = (bfd_byte *) bfd_malloc (8);
>> -             if (bfd_get_section_contents (abfd, tsection, tdata, (bfd_vma) xx, 8))
>> +         if (tdata)
>> +           {
>> +             if (bfd_get_section_contents (abfd, tsection,
>> +                                           tdata, (bfd_vma) xx, 8))
>>                {
>>                  bfd_vma eh, eh_data;
>>
>
> Here I don't see the reason for using 'int' as type for xx. Why not
> simply using here bfd_vma type and so no cast to this type is
> necessary?

And for extra bonus, rename the variable to something more
descriptive. :-)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Binutils mailing list