From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62677C43334 for ; Wed, 22 Jun 2022 02:39:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3D2D8E0078; Tue, 21 Jun 2022 22:39:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C4E48E006E; Tue, 21 Jun 2022 22:39:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 865778E0078; Tue, 21 Jun 2022 22:39:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 747518E006E for ; Tue, 21 Jun 2022 22:39:25 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F3B886069D for ; Wed, 22 Jun 2022 02:39:21 +0000 (UTC) X-FDA: 79604315364.03.57F666D Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf12.hostedemail.com (Postfix) with ESMTP id 8D4524001A for ; Wed, 22 Jun 2022 02:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655865559; x=1687401559; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=fIaPW9EydwDu0J9Dr9Y/O2l8kkF3T2/2aMlTVElF1Iw=; b=LSH8CLsExzuNJJ67u7z3gK/tazX/thvKacvJ4O19A3nZXXnj2S/wlP+0 Lm1ggM7wS2vUoMDlS8ho5JpSYWry6s5yHteWTf828qBFOokGnmXNMkNat QucIGrKG7jZ7mcrbqWHhqFQInjQo11CFY10liMLZRwh3WPoS1VB0nNBN/ Vqn3QakKABoquXlcAly3e9c4THFXWIBmvugkvyZHMBQF9+2A9R+z58ZxW W7T/Cb6OxNX+LD5q3PP8Y3Vgsg5c8DyqLdk065q5QS3O+tLnTZO+QJwX2 Ybi6wncGfRKMcPZi+QrSAZE1z7DoYtwcVJnj06EQKaf/hQlZEFKH70mzp A==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="366617382" X-IronPort-AV: E=Sophos;i="5.92,211,1650956400"; d="scan'208";a="366617382" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2022 19:37:41 -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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655865561; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=04p4TplPvC2PDvdJ4NqeADcta2tixb2BSW7M6gEV60I=; b=YoPq2tvv0kkmRdC0oFzJ8zYGqSlEvBCEOvfXpr9tTfsYreOWR21V1pwJvCXxSgXnJ3U9h/ 9wL/S3OxwnWJnHrPWim1sfnnNGyzOGN8LviQJFeRhZ4vuPlP9QDd6tet6kQZ0DnnHRJAH8 KWq0vwVEF8m0B3jwQEEWvR+y3FAHX8c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655865561; a=rsa-sha256; cv=none; b=Xg/6MpOTanyDQb0SdyMfsfZ46ycZ1WY4yZ0EuTf4liBCQsoTFvp6OK+2l2ooMKGw8pnrxo 9klgUyUJIqNmi9OT13AhxWSMSUBS9ngnOzAwexCMXKYlOETOp66M/lcSslkKZeSkpHG460 W7y5E9Chp8PdrhOoxm/R2cGFB654Fis= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=LSH8CLsE; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf12.hostedemail.com: domain of rong.a.chen@intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=rong.a.chen@intel.com X-Stat-Signature: fjreir119r5ofa3oxodcn8zskf4u8gik X-Rspamd-Queue-Id: 8D4524001A Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=LSH8CLsE; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf12.hostedemail.com: domain of rong.a.chen@intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=rong.a.chen@intel.com X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1655865559-965381 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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