[xlnx:xlnx_rebase_v5.4 1102/1697] include/uapi/linux/swab.h:20:38: warning: 'pmap' may be used uninitialized in this function

kernel test robot lkp at intel.com
Tue Jan 12 13:14:55 EST 2021


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   629150468791671b5fde21363e643e87c5815b17
commit: bbcf6f9bb1bc206330ca4d423e5a3966d8d82110 [1102/1697] net: xilinx: Add support for PL TSN IP features
config: h8300-allyesconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.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://github.com/Xilinx/linux-xlnx/commit/bbcf6f9bb1bc206330ca4d423e5a3966d8d82110
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx xlnx_rebase_v5.4
        git checkout bbcf6f9bb1bc206330ca4d423e5a3966d8d82110
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

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

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/timer.h:5,
                    from include/linux/netdevice.h:24,
                    from drivers/net/ethernet/xilinx/xilinx_axienet.h:12,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.h:21,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:18:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra]
      93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
         |                                                  ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   In file included from arch/h8300/include/asm/bug.h:8,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/h8300/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/ktime.h:24,
                    from include/linux/timer.h:6,
                    from include/linux/netdevice.h:24,
                    from drivers/net/ethernet/xilinx/xilinx_axienet.h:12,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.h:21,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:18:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
   include/asm-generic/page.h:91:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
      91 | #define pfn_valid(pfn)  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
         |                                ^~
   include/asm-generic/bug.h:139:27: note: in definition of macro 'WARN_ON_ONCE'
     139 |  int __ret_warn_once = !!(condition);   \
         |                           ^~~~~~~~~
   include/linux/dma-mapping.h:355:19: note: in expansion of macro 'pfn_valid'
     355 |  if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
         |                   ^~~~~~~~~
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:13,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/h8300/include/asm/byteorder.h:5,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/h8300/include/asm/bitops.h:171,
                    from include/linux/bitops.h:26,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/timer.h:5,
                    from include/linux/netdevice.h:24,
                    from drivers/net/ethernet/xilinx/xilinx_axienet.h:12,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.h:21,
                    from drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:18:
   drivers/net/ethernet/xilinx/xilinx_tsn_switch.c: In function 'tsnswitch_probe':
>> include/uapi/linux/swab.h:20:38: warning: 'pmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
      20 |  (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |  \
         |                                      ^~
   drivers/net/ethernet/xilinx/xilinx_tsn_switch.c:580:6: note: 'pmap' was declared here
     580 |  u32 pmap;
         |      ^~~~


vim +/pmap +20 include/uapi/linux/swab.h

607ca46e97a1b659 David Howells 2012-10-13   8  
607ca46e97a1b659 David Howells 2012-10-13   9  /*
607ca46e97a1b659 David Howells 2012-10-13  10   * casts are necessary for constants, because we never know how for sure
607ca46e97a1b659 David Howells 2012-10-13  11   * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
607ca46e97a1b659 David Howells 2012-10-13  12   */
607ca46e97a1b659 David Howells 2012-10-13  13  #define ___constant_swab16(x) ((__u16)(				\
607ca46e97a1b659 David Howells 2012-10-13  14  	(((__u16)(x) & (__u16)0x00ffU) << 8) |			\
607ca46e97a1b659 David Howells 2012-10-13  15  	(((__u16)(x) & (__u16)0xff00U) >> 8)))
607ca46e97a1b659 David Howells 2012-10-13  16  
607ca46e97a1b659 David Howells 2012-10-13  17  #define ___constant_swab32(x) ((__u32)(				\
607ca46e97a1b659 David Howells 2012-10-13  18  	(((__u32)(x) & (__u32)0x000000ffUL) << 24) |		\
607ca46e97a1b659 David Howells 2012-10-13  19  	(((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |		\
607ca46e97a1b659 David Howells 2012-10-13 @20  	(((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |		\
607ca46e97a1b659 David Howells 2012-10-13  21  	(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
607ca46e97a1b659 David Howells 2012-10-13  22  

:::::: The code at line 20 was first introduced by commit
:::::: 607ca46e97a1b6594b29647d98a32d545c24bdff UAPI: (Scripted) Disintegrate include/linux

:::::: TO: David Howells <dhowells at redhat.com>
:::::: CC: David Howells <dhowells at redhat.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 52689 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210113/8e25fc64/attachment-0001.gz>


More information about the linux-arm-kernel mailing list