Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4364966imm; Tue, 11 Sep 2018 10:44:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ6L+QZBrRWjmkPluZSpFei3pkRllU2KztY55vQvyCNhT8PlDrDfgj7HpC68jVv4avr4em/ X-Received: by 2002:a17:902:4403:: with SMTP id k3-v6mr28205940pld.243.1536687882073; Tue, 11 Sep 2018 10:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536687882; cv=none; d=google.com; s=arc-20160816; b=qIGvYj0SaQnLuPx+lSnyg+tKxQLHpozbxl0l/7zKpW24EMmR/1IodBPuzbltYiYfTT eS3KoGNyG2l9KWiir3cZfLZJm7nIjPKUKEiEjs5Xirt3cijBpkw/PxtVURIdfipauhPc P1OUgqbyGrbgT7750aLuNxRljT+ZXzDUFk4chw/iE4NSedCgiyiBp9Bu19WHYgDoF/B2 /WAJWwR5G/P0Rn9dWP+jIkGfJMrUAgAJSMMQLY0Fe72uljUcIzeQpemdOwmUQCpwknb0 PkiM+1VH7fKAQdDbe0zdUD1WhcuIAc0DwAGJuhWADVuA4Jxel2CXaYthYriqGQkXtYVd Mhjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xRIEVH4la4u2DmG4dm9X5bSHpkLA+BrFW+4ziQO1LTQ=; b=wpBmfbJPsBlQ3HLZybOra9JCLyuWAT7WUJQKMyNvKuyusuWfkUdTh0qW6mAKq48ewY Vd1tNWXBGe+fanUgmLyQentaz+hK/7qBnydPCLehvOCJw0mYKqq/CrkHU20LAp2QYyhW i/ex1EAAX2sSVsJJHhCaBtPKkCelvln62rJaUmwiStVCJccoYjhjRTG5UJZzvyByJEQD xa9sKlclHWISt2rgkBjD2qImIAg2blIcWEqYgSqP7whMvVzH7cOehwNVS6fmx28dUBmW fp+XubKR0ZlqjSKZPea83AUUD90ithJ69iWrx9Lp6CG3tIVgGr/bTaxy/IlJ2Q8kNHPh 6cCg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si21942567pls.36.2018.09.11.10.44.23; Tue, 11 Sep 2018 10:44:42 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbeIKWob (ORCPT + 99 others); Tue, 11 Sep 2018 18:44:31 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33387 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbeIKWob (ORCPT ); Tue, 11 Sep 2018 18:44:31 -0400 Received: by mail-qk1-f195.google.com with SMTP id z78-v6so17313662qka.0 for ; Tue, 11 Sep 2018 10:44:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xRIEVH4la4u2DmG4dm9X5bSHpkLA+BrFW+4ziQO1LTQ=; b=o4P9IENDBE9vwTqtd5XO/QI4F8vgtIQ3Eq+JC0HWsXuuIDsCYQe1BlU1eGeuxOl9pj uiXxfoAAJ9xqRY9KSiA83IoPPUyXYVXf8jIbX0VQIYFtqCM5SYGxkImd0Ek/rfvsc3on T7ux+XPPMd2OGuubnvkLB2cS9zG+ivIKN7lHe5xk6NMNBHp/nPxT9dpNxK4JwX0HMxJS 7aBOUkakRhtoqgH+0XNuxvlZ4qLRPTv5JRz3ya1Yxj6nQgGAlLKEuCAQgvcutvpLxW2k gX6tCEa1TbQVkBRv4D6ATOzAXQFOz7pBXnvYSDcI/zffTCWrUc9sLzz7k3OCV7t84wa3 CCTQ== X-Gm-Message-State: APzg51BD/DWcD2Gtx9kS9q3a42OYXuTOOBT7otcDvjunXDwgJyc0oi71 zO835rjYMrbzZoxHLBEQhRUZWg== X-Received: by 2002:ae9:dc43:: with SMTP id q64-v6mr20140113qkf.62.1536687848406; Tue, 11 Sep 2018 10:44:08 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::42c3]) by smtp.gmail.com with ESMTPSA id b3-v6sm13288306qtb.80.2018.09.11.10.44.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 10:44:07 -0700 (PDT) From: Laura Abbott To: Jason Wessel , Daniel Thompson , Arnd Bergmann Cc: Laura Abbott , Greg Kroah-Hartman , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCHv2] misc: kgdbts: Fix restrict error Date: Tue, 11 Sep 2018 10:44:03 -0700 Message-Id: <20180911174403.32088-1-labbott@redhat.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kgdbts current fails when compiled with restrict: drivers/misc/kgdbts.c: In function ‘configure_kgdbts’: drivers/misc/kgdbts.c:1070:2: error: ‘strcpy’ source argument is the same as destination [-Werror=restrict] strcpy(config, opt); ^~~~~~~~~~~~~~~~~~~ As the error says, config is being used in both the source and destination. Refactor the code to avoid the extra copy and put the parsing closer to the actual location. Signed-off-by: Laura Abbott --- v2: Refactored to move the verbose setting into kgbts_run_tests per suggestion of Daniel Thompson --- drivers/misc/kgdbts.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 6193270e7b3d..de20bdaa148d 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c @@ -985,6 +985,12 @@ static void kgdbts_run_tests(void) int nmi_sleep = 0; int i; + verbose = 0; + if (strstr(config, "V1")) + verbose = 1; + if (strstr(config, "V2")) + verbose = 2; + ptr = strchr(config, 'F'); if (ptr) fork_test = simple_strtol(ptr + 1, NULL, 10); @@ -1068,13 +1074,6 @@ static int kgdbts_option_setup(char *opt) return -ENOSPC; } strcpy(config, opt); - - verbose = 0; - if (strstr(config, "V1")) - verbose = 1; - if (strstr(config, "V2")) - verbose = 2; - return 0; } @@ -1086,9 +1085,6 @@ static int configure_kgdbts(void) if (!strlen(config) || isspace(config[0])) goto noconfig; - err = kgdbts_option_setup(config); - if (err) - goto noconfig; final_ack = 0; run_plant_and_detach_test(1); -- 2.17.1