This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] merge.c, don't pass null ptr to memcpy


On Wed, Jul 25, 2007 at 02:51:08PM -0700, msnyder@sonic.net wrote:
> If alignment_power can't be zero, there's no use testing it.
> If it can, we still need to allocate a pad buffer (albeit of
> one byte), because it will be passed to bfd_bwrite and hence
> to memcpy.

No, if alignment_power is zero, then pad will not be used because all
the pad lengths will be zero.  In fact, I think we are allocating one
more byte than necessary since the pad lengths ought to be 0 to
(1 << alignment_power) - 1.  I'll pre-approve a patch that changes
  char *pad = NULL;
to
  char *pad = "";
just to silence the warning.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]