From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20382 invoked by alias); 27 Feb 2011 22:00:11 -0000 Received: (qmail 20369 invoked by uid 22791); 27 Feb 2011 22:00:10 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Feb 2011 22:00:04 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id B22FA14006; Sun, 27 Feb 2011 14:00:03 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost4.vmware.com (Postfix) with ESMTP id 965C7C9E43; Sun, 27 Feb 2011 14:00:03 -0800 (PST) Message-ID: <4D6AC963.5040404@vmware.com> Date: Sun, 27 Feb 2011 22:05:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Mark Kettenis CC: "jan.kratochvil@redhat.com" , "gdb-patches@sourceware.org" , "dje@google.com" Subject: Re: [RFA] off by one array reference in i386-low.c/i386_show_dr References: <4D698427.2050301@vmware.com> <20110227164646.GA15468@host1.dyn.jankratochvil.net> <4D6AC1C3.10508@vmware.com> <201102272142.p1RLgURF009060@glazunov.sibelius.xs4all.nl> In-Reply-To: <201102272142.p1RLgURF009060@glazunov.sibelius.xs4all.nl> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2011-02/txt/msg00854.txt.bz2 Mark Kettenis wrote: >> Date: Sun, 27 Feb 2011 13:27:31 -0800 >> From: Michael Snyder >> >>>> --- i386-low.c 1 Jan 2011 15:33:24 -0000 1.5 >>>> +++ i386-low.c 26 Feb 2011 22:48:38 -0000 >>> /* A macro to loop over all debug registers. */ >>> #define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++) >>>> @@ -195,7 +195,7 @@ i386_show_dr (struct i386_debug_reg_stat >>> ALL_DEBUG_REGISTERS(i) >>> { >>> printf_unfiltered ("\ >>>> \tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n", >>>> i, paddress (state->dr_mirror[i]), >>>> state->dr_ref_count[i], >>>> - i + 1, paddress (state->dr_mirror[i + 1]), >>>> + i + 1, paddress (state->dr_mirror[i]), >>>> state->dr_ref_count[i + 1]); >>>> i++; >>>> } >>> -> >>> CONTROL (DR7): 0000000000090101 STATUS (DR6): 0000000000004000 >>> DR0: addr=0x0000000001c31f30, ref.count=1 DR1: addr=0x0000000000000000, ref.count=0 >>> DR2: addr=0x0000000000000000, ref.count=0 DR3: addr=0x0000000000000000, ref.count=0 >>> >>> I do not see a bug there; still it could be better commented. >> The bug is that when "i" is 3, "i + 1" is 4, and the array only runs >> from 0 to 3. > > But i can't be 3. Ah, ok, I'm finally seeing it. So this is a false positive from Coverity. This patch withdrawn. Thanks for the review.