From: kernel test robot <lkp@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: oe-kbuild-all@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [viro-vfs:work.dcache 6/6] fs/libfs.c:1819:17: warning: comparison of distinct pointer types lacks a cast
Date: Mon, 23 Dec 2024 21:02:58 +0800 [thread overview]
Message-ID: <202412232059.54ry0khI-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.dcache
head: 08141fdc186755910b5bffc21a4325e2b673629f
commit: 7cd7d43774879a6d7fc35662fb788ed8210dd09a [6/6] generic_ci_d_compare(): use shortname_storage
config: csky-randconfig-002-20241223 (https://download.01.org/0day-ci/archive/20241223/202412232059.54ry0khI-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241223/202412232059.54ry0khI-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412232059.54ry0khI-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/libfs.c: In function 'generic_ci_d_compare':
>> fs/libfs.c:1819:17: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
1819 | if (str == dentry->d_shortname.string) {
| ^~
vim +1819 fs/libfs.c
1776
1777 #if IS_ENABLED(CONFIG_UNICODE)
1778 /**
1779 * generic_ci_d_compare - generic d_compare implementation for casefolding filesystems
1780 * @dentry: dentry whose name we are checking against
1781 * @len: len of name of dentry
1782 * @str: str pointer to name of dentry
1783 * @name: Name to compare against
1784 *
1785 * Return: 0 if names match, 1 if mismatch, or -ERRNO
1786 */
1787 int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
1788 const char *str, const struct qstr *name)
1789 {
1790 const struct dentry *parent;
1791 const struct inode *dir;
1792 union shortname_store strbuf;
1793 struct qstr qstr;
1794
1795 /*
1796 * Attempt a case-sensitive match first. It is cheaper and
1797 * should cover most lookups, including all the sane
1798 * applications that expect a case-sensitive filesystem.
1799 *
1800 * This comparison is safe under RCU because the caller
1801 * guarantees the consistency between str and len. See
1802 * __d_lookup_rcu_op_compare() for details.
1803 */
1804 if (len == name->len && !memcmp(str, name->name, len))
1805 return 0;
1806
1807 parent = READ_ONCE(dentry->d_parent);
1808 dir = READ_ONCE(parent->d_inode);
1809 if (!dir || !IS_CASEFOLDED(dir))
1810 return 1;
1811
1812 /*
1813 * If the dentry name is stored in-line, then it may be concurrently
1814 * modified by a rename. If this happens, the VFS will eventually retry
1815 * the lookup, so it doesn't matter what ->d_compare() returns.
1816 * However, it's unsafe to call utf8_strncasecmp() with an unstable
1817 * string. Therefore, we have to copy the name into a temporary buffer.
1818 */
> 1819 if (str == dentry->d_shortname.string) {
1820 strbuf = dentry->d_shortname;
1821 strbuf.string[len] = 0;
1822 str = strbuf.string;
1823 /* prevent compiler from optimizing out the temporary buffer */
1824 barrier();
1825 }
1826 qstr.len = len;
1827 qstr.name = str;
1828
1829 return utf8_strncasecmp(dentry->d_sb->s_encoding, name, &qstr);
1830 }
1831 EXPORT_SYMBOL(generic_ci_d_compare);
1832
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-12-23 13:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202412232059.54ry0khI-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=oe-kbuild-all@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.