This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] merge.c, don't pass null ptr to memcpy
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: msnyder at sonic dot net
- Cc: binutils at sourceware dot org
- Date: Thu, 26 Jul 2007 16:21:41 +0930
- Subject: Re: [PATCH] merge.c, don't pass null ptr to memcpy
- References: <6014.12.7.175.2.1185400268.squirrel@webmail.sonic.net>
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