Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4406688iog; Tue, 21 Jun 2022 19:59:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1NKDBlLMNSQuvUsqxNTbqvuCHedA0MTjQ+zO7eF4Fu1Hdq6uWE549pI1QawMr0VnbouB+ X-Received: by 2002:a05:6a00:23d2:b0:525:25b9:233a with SMTP id g18-20020a056a0023d200b0052525b9233amr12777589pfc.20.1655866746343; Tue, 21 Jun 2022 19:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655866746; cv=none; d=google.com; s=arc-20160816; b=lrtP8YMimOwQxq1NHtS9iXuIZdLqaaT2TtJBdroW7XkiNtD3S7+EiB5TPGTl5t6lpn JQdADwfVM5k4BzWwEmYvS2Hld/DVDfm3aZg6nMOjXwqAJk3Yw3paa2nJHzrzmMW0XEFx eAE0t4FcXJXYkPiIttoU1/FADJWow+3fbQ08GwV/04rKJwo9gGRKJKK/o90ivpyZlg3c Cq+QIiLYu9exLw0Z+TbS26eXYMg7Rg+q4WSkhFwze01mkZ/bCK0zaafsll5HWoUxL+0F Dz/ljcuaJHmp+uzbjWEHnS+i1Bw+71+UUqGmK5UbdDkk6ScoGg+BnHNl9DuHgCEZq1sx pf6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=04p4TplPvC2PDvdJ4NqeADcta2tixb2BSW7M6gEV60I=; b=dOGpi3uTWDeUUYsB6ap2/dW551E6wwwOwawlfoYDsWi0ph2C3+PuD2yOAAv1f0QRRH jJQbqoSOGkKx3FEeuZU825uvZn3MidrrbEnTVHl+gMuBuesTkTRrbbPtusLPn/bY405w f4zeOL53ZNe/bBjPxZOoxDlIqpcGdEa2WtG/4eQyCz3h2dDeFQ9cFpQTJoXPRPq+26DS lBEb3e2gRVS3x9nPefFcBbpIumHyg1WuJmCVHLxLN9qS51aCWOUF/KinxcCjVoCtwEWD Fh5s87ObgH0sw6qlZJ8/rLiKqmd4frP5i23eExJlCLguq08PmGRqcJbb7JrQbUXBauzX Fz1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MDky9iUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k68-20020a628447000000b0051babb88d79si21804651pfd.277.2022.06.21.19.58.54; Tue, 21 Jun 2022 19:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MDky9iUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355886AbiFVChp (ORCPT + 99 others); Tue, 21 Jun 2022 22:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiFVChn (ORCPT ); Tue, 21 Jun 2022 22:37:43 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D71831340 for ; Tue, 21 Jun 2022 19:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655865463; x=1687401463; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=fIaPW9EydwDu0J9Dr9Y/O2l8kkF3T2/2aMlTVElF1Iw=; b=MDky9iUfBFfAioPH9FZEJO1E0sJwJOdXAda346u6Bc0qF+qp2v2ZFhRu QWUpjwOIq4gQAuoP8tHdwUz0LXWt9q7KqoSlRAngSbDTp6mEeZaz1igsd qY6bPDlBUl2lLRn0BYh7zGy+dhuDUP2a3SUv3LCXXdyNVNqO9p+Z1G71Y w7mlSHrjYcnXONABP6fwsvmSQdfXgXHKjTUArQU5VDASrMzCIFyE13oPP 0NyT+wN/rPUz4pPMtb0Si1Rm3CqAvMWVUx8cZqQrKN6Lkt4ceWPnQXk4l jw5e2gGvWwojB4SFbtDlugbF9MIcjb1jcX9WXZNktTSowOSanFHNUz36B g==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="260114706" X-IronPort-AV: E=Sophos;i="5.92,211,1650956400"; d="scan'208";a="260114706" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2022 19:37:42 -0700 X-IronPort-AV: E=Sophos;i="5.92,211,1650956400"; d="scan'208";a="591938680" Received: from rongch2-mobl.ccr.corp.intel.com (HELO [10.249.173.196]) ([10.249.173.196]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2022 19:37:39 -0700 Subject: Re: [kbuild-all] Re: mm/madvise.c:1438:6: warning: Redundant assignment of 'ret' to itself. [selfAssignment] To: Michal Hocko , Julia Lawall Cc: Charan Teja Kalla , kernel test robot , Minchan Kim , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Andrew Morton , Linux Memory Management List References: <202206180617.UzO7ymnD-lkp@intel.com> <5ec7b561-551b-f02a-9b7b-65d05ccdabbc@quicinc.com> From: "Chen, Rong A" Message-ID: <0a9d1c96-3a8d-70ee-1490-f65c1b4a6f00@intel.com> Date: Wed, 22 Jun 2022 10:37:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/21/2022 3:14 AM, Michal Hocko wrote: > On Mon 20-06-22 12:54:56, Julia Lawall wrote: >> >> >> On Mon, 20 Jun 2022, Michal Hocko wrote: >> >>> On Sat 18-06-22 11:25:43, Charan Teja Kalla wrote: >>>> Hello Andrew, >>>> [...] >>>>> cppcheck warnings: (new ones prefixed by >>) >>>>>>> mm/madvise.c:1438:6: warning: Redundant assignment of 'ret' to itself. [selfAssignment] >>>>> ret = (total_len - iov_iter_count(&iter)) ? : ret; >>>> >>>> Other way to avoid this warning is by creating another local variable >>>> that holds the total bytes processed. Having another local variable to >>>> get rid off some compilation warning doesn't seem proper to me. So, >>>> leaving this warning unless you ask me to fix this. >>> >>> Is this a new warning? I do not see it supported by my gcc 10.x. Do we >> >> cppcheck is a static analysis tool. It looks like it doesn't have a >> proper understanding of ?: > > Ohh, thanks for the clarification! I thought this was a gcc feature. > Then I would suggest to report a bug report against the static checker > rather than making any changes to the kernel to workaround it. > Hi all, Sorry for the inconvenience, we have added the warning to ignore list to avoid reporting it again. Best Regards, Rong Chen