From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9297 invoked by alias); 4 Feb 2014 19:25:56 -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 9229 invoked by uid 89); 4 Feb 2014 19:25:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Feb 2014 19:25:55 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s14JPqZn014813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Feb 2014 14:25:52 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s14JPolv027893; Tue, 4 Feb 2014 14:25:51 -0500 Message-ID: <52F13EBE.9040307@redhat.com> Date: Tue, 04 Feb 2014 19:25:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Use rs->buf after getpkt References: <1390652193-6018-1-git-send-email-yao@codesourcery.com> In-Reply-To: <1390652193-6018-1-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-02/txt/msg00024.txt.bz2 On 01/25/2014 12:16 PM, Yao Qi wrote: > Hi, > The following code snippet looks wrong to me > > char *buf = rs->buf; > > getpkt (&rs->buf, &rs->buf_size, 0); > packet_ok (buf, ); > > if rs->buf is reallocated in getpkt, buf points to an out of dated > memory. Indeed. > This patch removes local 'buf' and uses rs->buf. > > Regression tested on x86_64-linux. Is it OK? OK. -- Pedro Alves