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 0A50FC3F6B0 for ; Wed, 17 Aug 2022 17:10:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 630E76B0073; Wed, 17 Aug 2022 13:10:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DFF56B0074; Wed, 17 Aug 2022 13:10:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A7F68D0001; Wed, 17 Aug 2022 13:10:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3B9BA6B0073 for ; Wed, 17 Aug 2022 13:10:52 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 13B531C6FCF for ; Wed, 17 Aug 2022 17:10:52 +0000 (UTC) X-FDA: 79809724302.14.878B13F Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf29.hostedemail.com (Postfix) with ESMTP id 542121201CC for ; Wed, 17 Aug 2022 17:10:51 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 33C22CE1E23; Wed, 17 Aug 2022 17:10:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA73C433D6; Wed, 17 Aug 2022 17:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1660756246; bh=p2NKXCx6Gscl2EjobX5+YFwoNxczqPBGjK2p1lckArQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tv4GZKzSRl5TUaDsS9lzLULWc2NPFHVoTn+jOfjPz1Aaf6fa/8Z5XTlRNk6xpts2G 4mjWxwS07vbmrGp2qGjNLt3NHRZAq2/STQUv3w98d3kUKMjgGShigIYTPGJKlc62Kw KGuAEEIkYVt2+t9k+GSqe5nhPx6jylDumR4EVxus= Date: Wed, 17 Aug 2022 10:10:45 -0700 From: Andrew Morton To: kernel test robot Cc: Kalesh Singh , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Linux Memory Management List Subject: Re: [akpm-mm:mm-unstable 26/98] fs/libfs.c:1231:47: warning: Local variable 'anon_aops' shadows outer variable [shadowVariable] Message-Id: <20220817101045.3aaa1525eaf0dfb81287cdeb@linux-foundation.org> In-Reply-To: <202208152329.qv11tHmt-lkp@intel.com> References: <202208152329.qv11tHmt-lkp@intel.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660756251; a=rsa-sha256; cv=none; b=eG2sgL9L0O0E06J6fl5ANUPIN6LHygLfRSKgXoJM8jazbjPKM/AjFDHvattXnM3YUPC0nH p/RNbN86egrlgRaOpvcYQgYCNcUA2I7dPybvKxZVl5PwN4b6VZdOvdchO4ywl2vs6zUr5y dan50J626Eb8GFekn4QZ4EtrSb0Psc8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=tv4GZKzS; spf=pass (imf29.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660756251; 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=Pfqd9SnG615jrehaUdwbfKqbd/3cUu8KMhUisfOH9R4=; b=Y6iBPCZtRFmFljTlf8yv9TUqfjHQHaDtXwNG9Yltgybo1SL1soMPAlNB3cU0oCqFfsOX4b mFXkzWmYyylo+nTdpcqJKwLshkGQpj1+P4+WPyoM+J1S02NKCnJQHvct/T+/DtsvyqbS8F pBHtFfPFMPLNPDXjSRCnF1eSNSohDzs= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 542121201CC X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=tv4GZKzS; spf=pass (imf29.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: 4h6wrcxku66q4ywbhpwbki3b6i4z8fem X-HE-Tag: 1660756251-276434 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 15 Aug 2022 23:36:43 +0800 kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable > head: d2af7b221349ff6241e25fa8c67bcfae2b360700 > commit: e4ab315810850b93cac381d6f4efd532f45a790e [26/98] procfs: add 'path' to /proc//fdinfo/ > compiler: or1k-linux-gcc (GCC) 12.1.0 > reproduce (cppcheck warning): > # apt-get install cppcheck > git checkout e4ab315810850b93cac381d6f4efd532f45a790e > cppcheck --quiet --enable=style,performance,portability --template=gcc FILE > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot > > cppcheck warnings: (new ones prefixed by >>) > >> init/main.c:333:18: warning: Pointer addition with NULL pointer. [nullPointerArithmetic] > char *end = buf + size; > ^ > init/main.c:376:28: note: Calling function 'xbc_snprint_cmdline', 1st argument 'NULL' value is 0 > len = xbc_snprint_cmdline(NULL, 0, root); > ^ > init/main.c:333:18: note: Null pointer addition > char *end = buf + size; That's a pretty useless warning. > >> fs/libfs.c:1231:47: warning: Local variable 'anon_aops' shadows outer variable [shadowVariable] > static const struct address_space_operations anon_aops = { > ^ > fs/libfs.c:1220:46: note: Shadowed declaration > static const struct address_space_operations anon_aops = { > ^ > fs/libfs.c:1231:47: note: Shadow variable > static const struct address_space_operations anon_aops = { That's worth addressing. --- a/fs/libfs.c~procfs-add-path-to-proc-pid-fdinfo-fix +++ a/fs/libfs.c @@ -1228,7 +1228,7 @@ bool is_anon_inode(struct inode *inode) struct inode *alloc_anon_inode(struct super_block *s) { - static const struct address_space_operations anon_aops = { + static const struct address_space_operations aops = { .dirty_folio = noop_dirty_folio, }; struct inode *inode = new_inode_pseudo(s); @@ -1237,7 +1237,7 @@ struct inode *alloc_anon_inode(struct su return ERR_PTR(-ENOMEM); inode->i_ino = get_next_ino(); - inode->i_mapping->a_ops = &anon_aops; + inode->i_mapping->a_ops = &aops; /* * Mark the inode dirty from the very beginning, _