Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2713630imu; Sat, 10 Nov 2018 22:37:19 -0800 (PST) X-Google-Smtp-Source: AJdET5d2FxXFewR7u6CBEdL8k1m4/M1X/ZcOBJg1MDT9C63relwUkq/DqzKwJN+hCyo3tzneDN7Q X-Received: by 2002:a62:1e42:: with SMTP id e63-v6mr15453359pfe.149.1541918239641; Sat, 10 Nov 2018 22:37:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541918239; cv=none; d=google.com; s=arc-20160816; b=I8G24NNLYUdDIcbY3nAuuLVTp2epe7mimD7/Ncx/crn63l2uWOQl6JnE4lfRar0r9L 8NOgaONq7H719d7BMwUFMV52gbT3csjolUEMqjcxxYFgZlUcxp5udx9DrztqV2gYkH0M Sg/JqUCy36Xuvja3VSBtj7AOGlyc6mpPSS8orDbIChWSsNZQzNdcPkVcXRoONF61MdwB zVX+KSz7zhoNhkUf6imgfYjjJ4iUvVyZJNFSTNWQ6B+09YYpq1/1yMo0esmktPWw/I9r N1yHDeW1RItelT+DZVy648WFI0YtmV0gFskvWGQrAxCN2Rzcxecr6qyDsFFTE4ztjaev HZZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=BrGPZ88vgzmfMOSCFmpf8SS1uGuXLsfRalqr9eyxeCU=; b=OiVwZ8h//Virlx49hQmqdUMjkMlbEyUkblqdvWMsWrQn+aQwOP7myiZspHsjiHOgfQ ifsxOGx319bgT5/Olcw+M2cgBgH4c5EAz8l3yDNkDWqdvPcHmEFU9V4p/LDDDKitbYN8 LQ01OztvGAGLzbv0Kt/JmnQywoFHxHsSqNfrR0GHoa15EQAvabOMEm6FunYEFm6aRp4p 4QmKazwMKzQRRohTT58wDskD2Gtw7MzCh0Dl2biAu5dgx4S2drLpVMS99ZfGDZfnCKp5 jMDYV0xx9L+dTEQAaquiPhmxE6eCd7w7AAOjsdm/yaj5wQCUiUBGH8MQwsmJN9pfR/Lj S1yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si14108644pld.137.2018.11.10.22.36.25; Sat, 10 Nov 2018 22:37:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbeKKQXJ (ORCPT + 99 others); Sun, 11 Nov 2018 11:23:09 -0500 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:25452 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbeKKQXH (ORCPT ); Sun, 11 Nov 2018 11:23:07 -0500 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Sat, 10 Nov 2018 22:35:01 -0800 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 81B3440732; Sat, 10 Nov 2018 22:35:24 -0800 (PST) From: Nadav Amit To: Ingo Molnar CC: , , "H. Peter Anvin" , Thomas Gleixner , Borislav Petkov , Dave Hansen , Nadav Amit Subject: [PATCH v4 07/10] x86/kgdb: avoid redundant comparison of code Date: Sat, 10 Nov 2018 15:17:29 -0800 Message-ID: <20181110231732.15060-8-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181110231732.15060-1-namit@vmware.com> References: <20181110231732.15060-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 8091b2e381d4..d14e1be576fd 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c @@ -751,7 +751,6 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) { int err; - char opc[BREAK_INSTR_SIZE]; bpt->type = BP_BREAKPOINT; err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, @@ -772,11 +771,6 @@ int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) BREAK_INSTR_SIZE); if (err) return err; - err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); - if (err) - return err; - if (memcmp(opc, arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE)) - return -EINVAL; bpt->type = BP_POKE_BREAKPOINT; return err; @@ -785,7 +779,6 @@ int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) { int err; - char opc[BREAK_INSTR_SIZE]; if (bpt->type != BP_POKE_BREAKPOINT) goto knl_write; @@ -798,9 +791,6 @@ int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) err = text_poke_kgdb((void *)bpt->bpt_addr, bpt->saved_instr, BREAK_INSTR_SIZE); if (err) - return err; - err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); - if (err || memcmp(opc, bpt->saved_instr, BREAK_INSTR_SIZE)) goto knl_write; return err; -- 2.17.1