This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH][genattrtab] Fix memory corruption, allocate enough memory for all bypassed reservations
- From: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- To: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Jun 2014 09:12:45 +0100
- Subject: Re: [PATCH][genattrtab] Fix memory corruption, allocate enough memory for all bypassed reservations
- Authentication-results: sourceware.org; auth=none
- References: <539ACAD9 dot 7030501 at arm dot com> <539B1DF4 dot 5080909 at redhat dot com> <539EC327 dot 2040004 at arm dot com> <539F1DDD dot 7070002 at redhat dot com>
On 16/06/14 17:39, Jeff Law wrote:
On 06/16/14 04:12, Kyrill Tkachov wrote:
Doh, you're right. I did consider it but for some reason thought we
might want to iterate over all of the bypasses anyway. Breaking out
How about this?
Tested on arm and aarch64 and confirmed with valgrind that no out of
bounds accesses occur.
I kicked off an x86_64 bootstrap but don't expect any problems.
Author: Kyrylo Tkachov<email@example.com>
Date: Fri Jun 13 11:09:57 2014 +0100
[genattrtab] Fix memory corruption with bypasses
I'm an idiot. n_bypassed is used to size the vector, so you do have to
walk the entire list.
AFAICS in the loop in process_bypasses we want to count all the
reservations which have a bypass matching them. Once a reservation is
matched with a bypass it should be safe to break out of the inner loop
(over the bypasses), even if two bypasses match a reservation we only
want to count the reservation once.
So I think the 2nd version of the patch is good