[linux-next:master 4146/4465] fs/quota/dquot.c:1699:25: sparse: sparse: incompatible types in comparison expression (different address spaces):

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ac139fc7db67968e5061715508b5fc4aa7c40c56
commit: d0aa72604fbd80c8aabb46eda00535ed35570f1f [4146/4465] quota: Fix potential NULL pointer dereference
config: x86_64-randconfig-122-20240206 (https://download.01.org/0day-ci/archive/20240206/202402061900.rTuYDlo6-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/202402061900.rTuYDlo6-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402061900.rTuYDlo6-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> fs/quota/dquot.c:1699:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1699:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1699:25: sparse:    struct dquot *
   fs/quota/dquot.c:1710:41: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1710:41: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1710:41: sparse:    struct dquot *
   fs/quota/dquot.c:1760:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1760:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1760:25: sparse:    struct dquot *
   fs/quota/dquot.c:1766:41: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1766:41: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1766:41: sparse:    struct dquot *
   fs/quota/dquot.c:1810:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1810:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1810:25: sparse:    struct dquot *
   fs/quota/dquot.c:1852:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1852:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1852:25: sparse:    struct dquot *
   fs/quota/dquot.c:1901:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1901:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1901:25: sparse:    struct dquot *
   fs/quota/dquot.c:1949:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:1949:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:1949:25: sparse:    struct dquot *
   fs/quota/dquot.c: note: in included file (through include/linux/wait.h, include/linux/wait_bit.h, include/linux/fs.h):
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *
   fs/quota/dquot.c:409:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/quota/dquot.c:409:25: sparse:    struct dquot [noderef] __rcu *
   fs/quota/dquot.c:409:25: sparse:    struct dquot *

vim +1699 fs/quota/dquot.c

  1659	
  1660	/*
  1661	 * This functions updates i_blocks+i_bytes fields and quota information
  1662	 * (together with appropriate checks).
  1663	 *
  1664	 * NOTE: We absolutely rely on the fact that caller dirties the inode
  1665	 * (usually helpers in quotaops.h care about this) and holds a handle for
  1666	 * the current transaction so that dquot write and inode write go into the
  1667	 * same transaction.
  1668	 */
  1669	
  1670	/*
  1671	 * This operation can block, but only after everything is updated
  1672	 */
  1673	int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
  1674	{
  1675		int cnt, ret = 0, index;
  1676		struct dquot_warn warn[MAXQUOTAS];
  1677		int reserve = flags & DQUOT_SPACE_RESERVE;
  1678		struct dquot **dquots;
  1679		struct dquot *dquot;
  1680	
  1681		if (!inode_quota_active(inode)) {
  1682			if (reserve) {
  1683				spin_lock(&inode->i_lock);
  1684				*inode_reserved_space(inode) += number;
  1685				spin_unlock(&inode->i_lock);
  1686			} else {
  1687				inode_add_bytes(inode, number);
  1688			}
  1689			goto out;
  1690		}
  1691	
  1692		for (cnt = 0; cnt < MAXQUOTAS; cnt++)
  1693			warn[cnt].w_type = QUOTA_NL_NOWARN;
  1694	
  1695		dquots = i_dquot(inode);
  1696		index = srcu_read_lock(&dquot_srcu);
  1697		spin_lock(&inode->i_lock);
  1698		for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
> 1699			dquot = srcu_dereference(dquots[cnt], &dquot_srcu);
  1700			if (!dquot)
  1701				continue;
  1702			if (reserve) {
  1703				ret = dquot_add_space(dquot, 0, number, flags, &warn[cnt]);
  1704			} else {
  1705				ret = dquot_add_space(dquot, number, 0, flags, &warn[cnt]);
  1706			}
  1707			if (ret) {
  1708				/* Back out changes we already did */
  1709				for (cnt--; cnt >= 0; cnt--) {
  1710					dquot = srcu_dereference(dquots[cnt], &dquot_srcu);
  1711					if (!dquot)
  1712						continue;
  1713					spin_lock(&dquot->dq_dqb_lock);
  1714					if (reserve)
  1715						dquot_free_reserved_space(dquot, number);
  1716					else
  1717						dquot_decr_space(dquot, number);
  1718					spin_unlock(&dquot->dq_dqb_lock);
  1719				}
  1720				spin_unlock(&inode->i_lock);
  1721				goto out_flush_warn;
  1722			}
  1723		}
  1724		if (reserve)
  1725			*inode_reserved_space(inode) += number;
  1726		else
  1727			__inode_add_bytes(inode, number);
  1728		spin_unlock(&inode->i_lock);
  1729	
  1730		if (reserve)
  1731			goto out_flush_warn;
  1732		mark_all_dquot_dirty(dquots);
  1733	out_flush_warn:
  1734		srcu_read_unlock(&dquot_srcu, index);
  1735		flush_warnings(warn);
  1736	out:
  1737		return ret;
  1738	}
  1739	EXPORT_SYMBOL(__dquot_alloc_space);
  1740	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux