Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp46947imm; Tue, 18 Sep 2018 16:15:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbujE+NGtZI4p/6yvFkhgJDKBh2I2Avy3Kz5dHwEVCsfMfUluL7mRNYNIc96mgnBipNQA0o X-Received: by 2002:a62:d2c4:: with SMTP id c187-v6mr33004474pfg.8.1537312555196; Tue, 18 Sep 2018 16:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537312555; cv=none; d=google.com; s=arc-20160816; b=ZgKUxahfmOIhq2ROp8MZHWCIix1i1dxKQ4BrPatk8IRn+RkSF6ELRF6NfoG8c6984L gdPJ3/pqKdE4wpRVX4sIdjcX26PjuKOsX/HWNXE2+AYIkkBDgMmhkSdvXOBqijgxnsAS NSKtOMKkGRHDPwNkANXjp+JHbztIkVQ9A4z6y1wxqWVeqbusTC/l5/ebssopZnn3LUPp CjTgfTWtxaua7T9wi1as3tLyJrHgphr0vSTsc4wstQmSr/BBfZM+a7kjVZ58kYbyX39i zPv/WmQHIJkWwPfKEyM/wYLeuCMP1ihvMxXZNV4aXbBPP49pR5SBWlSBeNiscx4JXBjD yB9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Gp6sMzc9rjka+xKBsb2Fo/YxyBwNUaNCDXgZtP2yKk=; b=yNPHXwDWdPHYs9Xxc2XCXjNQvkKFTBSrSigPqmlok14ESF8uzeRNnunc/VEWv7rlNP ymtkmlF/U8tipNknag83vj5zBXyO1nfce41x+FmMbPn+a5T2XZtGhs5zbjbpxctH0Zqd IgJZzOzd/iZedfUBNvAVKnHdAi4E3rb4apN5Jow/Tzq7heRKxVoygoWPYm4Oo0UHu5uJ uM5NDa40frcYNLJ9lc+TZmIllK+8vAWrsHONWgv3fv2ag4va6Kg/iwwQTX6J4eleBdjE 28dtEbhwWWJRoPTDHs0m0EksdmPjWA82d0tC3bP+5YI3wxF8lH7DmKWTRsJLBTEjMqgA 88WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LaRhAeCq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6-v6si20833376pfe.31.2018.09.18.16.15.39; Tue, 18 Sep 2018 16:15:55 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LaRhAeCq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728194AbeISEto (ORCPT + 99 others); Wed, 19 Sep 2018 00:49:44 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37147 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbeISEto (ORCPT ); Wed, 19 Sep 2018 00:49:44 -0400 Received: by mail-pg1-f195.google.com with SMTP id 2-v6so1761759pgo.4 for ; Tue, 18 Sep 2018 16:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1Gp6sMzc9rjka+xKBsb2Fo/YxyBwNUaNCDXgZtP2yKk=; b=LaRhAeCqyFaTJXihh1rOdB6gWqGx9RwNif0FGOwcTWyr+tyPN5WzB0z8V1QZpO7y1s W0Tp67H7B6YsWodTwT0emxK0Xx1ppCtfm+lLytSn3sL9lzQ92rprQehKTSkA+nCOOndt ImXXAIvjSowXnhi8kH+U5+kjXP62Eb35U5nmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=1Gp6sMzc9rjka+xKBsb2Fo/YxyBwNUaNCDXgZtP2yKk=; b=iAJrPLRX84jgmyXSsOL2ksH5AbOa6Y0hYl+VObgdn/tdMBhnbPIpbvt6ZYtgkbh4SV Pv/IqrPfObXJIO/7TF0spKKBLU5ol/Y9c+d2m/7KBkDoPP7uuokOOBT/hpXGdWj1LmAX ZZNHmmZClhwdr6VpaS+XDmZYygefQ/tb3IH25II0MUYr27cbhO3hHhaBjuWa3zou/v6H zSlSnxAan2+3kY/aFtf2R5sR6+EQZ3iyRD3zn0PIM5/w0cCrVHok4MCoLGzSuJTcudfM EMbAdzlOHqjgEyvco/8sKJUkbz5cba8ye0Df0ca8E+Zr4ifOYrb6CQ3dJMuwItD2Y4rx IH6g== X-Gm-Message-State: APzg51CPq8X+IvFWGkxQIaZkwNOBi6dRZDbmS+ZJLiCilTbXm/5aLNle 6RR1bg9MM5H2lS5zJ2whldgKkO6/YVZ4+Q== X-Received: by 2002:a62:4898:: with SMTP id q24-v6mr33348806pfi.22.1537312491376; Tue, 18 Sep 2018 16:14:51 -0700 (PDT) Received: from holly.lan ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id n83-v6sm42805317pfk.19.2018.09.18.16.14.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Sep 2018 16:14:50 -0700 (PDT) Date: Tue, 18 Sep 2018 16:14:49 -0700 From: Daniel Thompson To: Laura Abbott Cc: Jason Wessel , Arnd Bergmann , Greg Kroah-Hartman , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] misc: kgdbts: Fix restrict error Message-ID: <20180918231449.akg2qjgaohedtx4h@holly.lan> References: <20180911174403.32088-1-labbott@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180911174403.32088-1-labbott@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 11, 2018 at 10:44:03AM -0700, Laura Abbott wrote: > 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 Acked-by: Daniel Thompson > --- > 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 >