* [viro-vfs:work.dcache 6/6] fs/libfs.c:1819:17: warning: comparison of distinct pointer types lacks a cast
@ 2024-12-23 13:02 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-23 13:02 UTC (permalink / raw)
To: Al Viro; +Cc: oe-kbuild-all, linux-fsdevel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-23 13:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-23 13:02 [viro-vfs:work.dcache 6/6] fs/libfs.c:1819:17: warning: comparison of distinct pointer types lacks a cast kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox