lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108200415.7lAXba6f-lkp@intel.com>
Date:   Fri, 20 Aug 2021 04:35:24 +0800
From:   kernel test robot <lkp@...el.com>
To:     David Howells <dhowells@...hat.com>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [dhowells-fs:netfs-folio-regions 18/28] fs/netfs/write_prep.c:78:10:
 warning: comparison of distinct pointer types ('typeof (len) *' (aka
 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long
 *'))

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions
head:   215a4ee495a95cc73256ed76f91cb78bcabd6b8e
commit: 0c1c1796fd33fded73a9a4305a9e43e8922746ee [18/28] netfs: Do encryption in write preparatory phase
config: hexagon-randconfig-r041-20210818 (attached as .config)
compiler: clang version 12.0.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=0c1c1796fd33fded73a9a4305a9e43e8922746ee
        git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
        git fetch --no-tags dhowells-fs netfs-folio-regions
        git checkout 0c1c1796fd33fded73a9a4305a9e43e8922746ee
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=hexagon 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> fs/netfs/write_prep.c:78:10: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 18) - offset) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types]
                           seg = min(len, PAGE_SIZE - offset);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.


vim +78 fs/netfs/write_prep.c

    46	
    47	/*
    48	 * Populate a scatterlist from folios in an xarray.
    49	 */
    50	static int netfs_xarray_to_sglist(struct xarray *xa, loff_t pos, size_t len,
    51					  struct scatterlist *sg, unsigned int n_sg)
    52	{
    53		struct scatterlist *p = sg;
    54		struct folio *folio = NULL;
    55		size_t seg, offset, skip = 0;
    56		loff_t start = pos;
    57		pgoff_t index = start >> PAGE_SHIFT;
    58		int j;
    59	
    60		XA_STATE(xas, xa, index);
    61	
    62		sg_init_table(sg, n_sg);
    63	
    64		rcu_read_lock();
    65	
    66		xas_for_each(&xas, folio, ULONG_MAX) {
    67			kdebug("LOAD %lx %px", folio->index, folio);
    68			if (xas_retry(&xas, folio))
    69				continue;
    70			if (WARN_ON(xa_is_value(folio)) || WARN_ON(folio_test_hugetlb(folio)))
    71				break;
    72			for (j = (folio_index(folio) < index) ? index - folio_index(folio) : 0;
    73			     j < folio_nr_pages(folio); j++
    74			     ) {
    75				struct page *subpage = folio_file_page(folio, j);
    76	
    77				offset = (pos + skip) & ~PAGE_MASK;
  > 78				seg = min(len, PAGE_SIZE - offset);
    79	
    80				kdebug("[%zx] %lx %zx @%zx", p - sg, subpage->index, seg, offset);
    81				sg_set_page(p++, subpage, seg, offset);
    82	
    83				len -= seg;
    84				skip += seg;
    85				if (len == 0)
    86					break;
    87			}
    88			if (len == 0)
    89				break;
    90		}
    91	
    92		rcu_read_unlock();
    93		if (len > 0) {
    94			WARN_ON(len > 0);
    95			return -EIO;
    96		}
    97	
    98		sg_mark_end(p - 1);
    99		kleave(" = %zd", p - sg);
   100		return p - sg;
   101	}
   102	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (26608 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ