From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23802 invoked by alias); 23 Nov 2014 09:13:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23793 invoked by uid 89); 23 Nov 2014 09:13:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: sonata.ens-lyon.org Received: from sonata.ens-lyon.org (HELO sonata.ens-lyon.org) (140.77.166.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 23 Nov 2014 09:13:55 +0000 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 5F4B7200AF; Sun, 23 Nov 2014 10:13:51 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BqBpmrhyfWBs; Sun, 23 Nov 2014 10:13:51 +0100 (CET) Received: from type.youpi.perso.aquilenet.fr (youpi.perso.aquilenet.fr [80.67.176.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id C7073200A8; Sun, 23 Nov 2014 10:13:50 +0100 (CET) Received: from samy by type.youpi.perso.aquilenet.fr with local (Exim 4.84) (envelope-from ) id 1XsTEp-0000u8-Od; Sun, 23 Nov 2014 10:13:47 +0100 Date: Sun, 23 Nov 2014 09:13:00 -0000 From: Samuel Thibault To: Joel Brobecker Cc: bug-hurd@gnu.org, thomas@codesourcery.com, gdb-patches@sourceware.org Subject: Re: [PATCH,Hurd] Fix deallocation after proc_getprocinfo call Message-ID: <20141123091347.GV4576@type.youpi.perso.aquilenet.fr> Mail-Followup-To: Joel Brobecker , bug-hurd@gnu.org, thomas@codesourcery.com, gdb-patches@sourceware.org References: <20141102152537.GG2991@type.youpi.perso.aquilenet.fr> <20141123074452.GC7136@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141123074452.GC7136@adacore.com> User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) X-SW-Source: 2014-11/txt/msg00557.txt.bz2 Joel Brobecker, le Sun 23 Nov 2014 11:44:52 +0400, a écrit : > > - vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len); > > + vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len * sizeof (*(procinfo_t) 0)); > > Suggest using "sizeof (struct procinfo)", which I think is better > than dereferencing a NULL pointer. This is based on guessing that > type procinfo_t is a pointer to struct procinfo, as suggested by > the code in inf_validate_procinfo. Not, that is not the same: struct procinfo has an open array at its end (threadinfos[0]), and thus the actually allocated size is variable. Samuel