From patchwork Wed Oct 14 11:14:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: henrik.wallin@windriver.com X-Patchwork-Id: 9104 Received: (qmail 85186 invoked by alias); 14 Oct 2015 15:07:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85155 invoked by uid 89); 14 Oct 2015 15:07:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail.windriver.com Received: from mail.windriver.com (HELO mail.windriver.com) (147.11.1.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 14 Oct 2015 15:07:32 +0000 Received: from arn-build2.wrs.com (arn-build2.wrs.com [128.224.95.15]) by mail.windriver.com (8.15.2/8.15.1) with ESMTP id t9EBEZ9p010720 for ; Wed, 14 Oct 2015 04:14:35 -0700 (PDT) Received: by arn-build2.wrs.com (Postfix, from userid 18580) id E4A89220B19; Wed, 14 Oct 2015 13:14:33 +0200 (CEST) From: henrik.wallin@windriver.com To: gdb-patches@sourceware.org Subject: [RFC][PATCH 08/15] gdbserver: Move pointer dereference to after assert checks. Date: Wed, 14 Oct 2015 13:14:26 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: From: Henrik Wallin gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_new_thread): Move pointer dereference to after assert checks. Signed-off-by: Henrik Wallin --- gdb/gdbserver/linux-arm-low.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index a277bb6876fb..81d23d953434 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -686,8 +686,8 @@ arm_new_thread (struct lwp_info *lwp) static void arm_new_fork (struct process_info *parent, struct process_info *child) { - struct arch_process_info *parent_proc_info = parent->priv->arch_private; - struct arch_process_info *child_proc_info = child->priv->arch_private; + struct arch_process_info *parent_proc_info; + struct arch_process_info *child_proc_info; struct lwp_info *child_lwp; struct arch_lwp_info *child_lwp_info; int i; @@ -698,6 +698,9 @@ arm_new_fork (struct process_info *parent, struct process_info *child) gdb_assert (child->priv != NULL && child->priv->arch_private != NULL); + parent_proc_info = parent->priv->arch_private; + child_proc_info = child->priv->arch_private; + /* Linux kernel before 2.6.33 commit 72f674d203cd230426437cdcf7dd6f681dad8b0d will inherit hardware debug registers from parent