From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev,
"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
Ira Weiny <ira.weiny@intel.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 2/4] fs/sysv: Change the signature of dir_get_page()
Date: Wed, 4 Jan 2023 14:59:24 +0300 [thread overview]
Message-ID: <202301041814.3Lbh2QfK-lkp@intel.com> (raw)
In-Reply-To: <20221231075717.10258-3-fmdefrancesco@gmail.com>
Hi Fabio,
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Fabio-M-De-Francesco/fs-sysv-Use-the-offset_in_page-helper/20221231-155850
base: git://git.infradead.org/users/hch/configfs.git for-next
patch link: https://lore.kernel.org/r/20221231075717.10258-3-fmdefrancesco%40gmail.com
patch subject: [PATCH 2/4] fs/sysv: Change the signature of dir_get_page()
config: xtensa-randconfig-m031-20230101
compiler: xtensa-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
fs/sysv/dir.c:190 sysv_add_link() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +190 fs/sysv/dir.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 174 int sysv_add_link(struct dentry *dentry, struct inode *inode)
^1da177e4c3f41 Linus Torvalds 2005-04-16 175 {
2b0143b5c986be David Howells 2015-03-17 176 struct inode *dir = d_inode(dentry->d_parent);
^1da177e4c3f41 Linus Torvalds 2005-04-16 177 const char * name = dentry->d_name.name;
^1da177e4c3f41 Linus Torvalds 2005-04-16 178 int namelen = dentry->d_name.len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 179 struct page *page = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 180 struct sysv_dir_entry * de;
^1da177e4c3f41 Linus Torvalds 2005-04-16 181 unsigned long npages = dir_pages(dir);
^1da177e4c3f41 Linus Torvalds 2005-04-16 182 unsigned long n;
^1da177e4c3f41 Linus Torvalds 2005-04-16 183 char *kaddr;
26a6441aadde86 Nicholas Piggin 2007-10-16 184 loff_t pos;
^1da177e4c3f41 Linus Torvalds 2005-04-16 185 int err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 186
^1da177e4c3f41 Linus Torvalds 2005-04-16 187 /* We take care of directory expansion in the same loop */
^1da177e4c3f41 Linus Torvalds 2005-04-16 188 for (n = 0; n <= npages; n++) {
4b8a9c0afda16b Fabio M. De Francesco 2022-12-31 189 kaddr = dir_get_page(dir, n, &page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @190 err = PTR_ERR(page);
This "err" assignment is a dead store (pointless/never used).
4b8a9c0afda16b Fabio M. De Francesco 2022-12-31 191 if (IS_ERR(kaddr))
4b8a9c0afda16b Fabio M. De Francesco 2022-12-31 192 return PTR_ERR(kaddr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 193 de = (struct sysv_dir_entry *)kaddr;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 194 kaddr += PAGE_SIZE - SYSV_DIRSIZE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 195 while ((char *)de <= kaddr) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 196 if (!de->inode)
^1da177e4c3f41 Linus Torvalds 2005-04-16 197 goto got_it;
^1da177e4c3f41 Linus Torvalds 2005-04-16 198 err = -EEXIST;
^1da177e4c3f41 Linus Torvalds 2005-04-16 199 if (namecompare(namelen, SYSV_NAMELEN, name, de->name))
^1da177e4c3f41 Linus Torvalds 2005-04-16 200 goto out_page;
^1da177e4c3f41 Linus Torvalds 2005-04-16 201 de++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 202 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 203 dir_put_page(page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 204 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 205 BUG();
^1da177e4c3f41 Linus Torvalds 2005-04-16 206 return -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 207
^1da177e4c3f41 Linus Torvalds 2005-04-16 208 got_it:
1023904333f9cb Fabio M. De Francesco 2022-12-31 209 pos = page_offset(page) + offset_in_page(de);
^1da177e4c3f41 Linus Torvalds 2005-04-16 210 lock_page(page);
f4e420dc423148 Christoph Hellwig 2010-06-04 211 err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 212 if (err)
^1da177e4c3f41 Linus Torvalds 2005-04-16 213 goto out_unlock;
^1da177e4c3f41 Linus Torvalds 2005-04-16 214 memcpy (de->name, name, namelen);
^1da177e4c3f41 Linus Torvalds 2005-04-16 215 memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
^1da177e4c3f41 Linus Torvalds 2005-04-16 216 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
26a6441aadde86 Nicholas Piggin 2007-10-16 217 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
02027d42c3f747 Deepa Dinamani 2016-09-14 218 dir->i_mtime = dir->i_ctime = current_time(dir);
^1da177e4c3f41 Linus Torvalds 2005-04-16 219 mark_inode_dirty(dir);
^1da177e4c3f41 Linus Torvalds 2005-04-16 220 out_page:
^1da177e4c3f41 Linus Torvalds 2005-04-16 221 dir_put_page(page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 222 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 223 out_unlock:
^1da177e4c3f41 Linus Torvalds 2005-04-16 224 unlock_page(page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 225 goto out_page;
^1da177e4c3f41 Linus Torvalds 2005-04-16 226 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next prev parent reply other threads:[~2023-01-04 12:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 7:57 [PATCH 0/4] fs/sysv: Replace kmap() with kmap_local_page() Fabio M. De Francesco
2022-12-31 7:57 ` [PATCH 1/4] fs/sysv: Use the offset_in_page() helper Fabio M. De Francesco
2022-12-31 7:57 ` [PATCH 2/4] fs/sysv: Change the signature of dir_get_page() Fabio M. De Francesco
2023-01-04 11:59 ` Dan Carpenter [this message]
2023-01-04 13:02 ` Fabio M. De Francesco
2022-12-31 7:57 ` [PATCH 3/4] fs/sysv: Use dir_put_page() in sysv_rename() Fabio M. De Francesco
2022-12-31 7:57 ` [PATCH 4/4] fs/sysv: Replace kmap() with kmap_local_page() Fabio M. De Francesco
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=202301041814.3Lbh2QfK-lkp@intel.com \
--to=error27@gmail.com \
--cc=fmdefrancesco@gmail.com \
--cc=hch@infradead.org \
--cc=ira.weiny@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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