From: Andrew Morton <akpm@linux-foundation.org>
To: kernel test robot <lkp@intel.com>
Cc: Kalesh Singh <kaleshsingh@google.com>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [akpm-mm:mm-unstable 26/98] fs/libfs.c:1231:47: warning: Local variable 'anon_aops' shadows outer variable [shadowVariable]
Date: Wed, 17 Aug 2022 10:10:45 -0700 [thread overview]
Message-ID: <20220817101045.3aaa1525eaf0dfb81287cdeb@linux-foundation.org> (raw)
In-Reply-To: <202208152329.qv11tHmt-lkp@intel.com>
On Mon, 15 Aug 2022 23:36:43 +0800 kernel test robot <lkp@intel.com> 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/<pid>/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 <lkp@intel.com>
>
> 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,
_
prev parent reply other threads:[~2022-08-17 17:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 15:36 kernel test robot
2022-08-17 17:10 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220817101045.3aaa1525eaf0dfb81287cdeb@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kaleshsingh@google.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox