From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9176 invoked by alias); 28 Jul 2007 10:20:02 -0000 Received: (qmail 9126 invoked by uid 22791); 28 Jul 2007 10:20:01 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Jul 2007 10:19:57 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l6SAOKq6001302; Sat, 28 Jul 2007 12:24:20 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l6SAOKwG001301; Sat, 28 Jul 2007 12:24:20 +0200 Date: Sat, 28 Jul 2007 11:54:00 -0000 From: Jakub Jelinek To: msnyder@sonic.net Cc: binutils@sourceware.org Subject: Re: [PATCH] elf-eh-frame, move buffer alloc out of if block Message-ID: <20070728102419.GS4603@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek References: <16917.12.7.175.2.1185571279.squirrel@webmail.sonic.net> <20070727223244.GR4603@sunsite.mff.cuni.cz> <4606.12.7.175.2.1185580330.squirrel@webmail.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4606.12.7.175.2.1185580330.squirrel@webmail.sonic.net> User-Agent: Mutt/1.4.2.2i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00512.txt.bz2 On Fri, Jul 27, 2007 at 04:52:10PM -0700, msnyder@sonic.net wrote: > > So, if ecies is NULL (implies invalid .eh_frame section and also > > ecie_count == 0), I don't see anything invalid on the > > ecie = NULL assignment or NULL < NULL + 0 comparison (false), then it > > will just do if (NULL == NULL + 0) goto free_no_table; > > Well, that reasoning requires that you *know* that (ecies == NULL) > implies invalid .eh_frame section and ecie_count == 0. But sufficiently good analysis tool must be able to figure that out. Initially ecies = NULL and ecie_count = 0 (var initialization at their respective definitions). The only place where ecie_count is increased is after ecies = bfd_realloc () succeeded, at which point ecies != NULL. So I'm not really sure we should work around Coverity inefficiencies. You need to take the reported issues with a grain of salt, they show where a problem might be. You then analyze the thing and either assess there is no problem and ideally report that to the provider of the tool, so that they can improve it, or fix the problem. Jakub