GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [ammarfaizi2-block:axboe/linux-block/for-6.3/io_uring 37/41] io_uring/io_uring.c:2373:8: warning: 'const' type qualifier on return type has no effect
@ 2023-01-24  2:21 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-01-24  2:21 UTC (permalink / raw)
  To: Pavel Begunkov
  Cc: llvm, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List, Jens Axboe

tree:   https://github.com/ammarfaizi2/linux-block axboe/linux-block/for-6.3/io_uring
head:   73b62ca46fe7e10334f601643c2ccd4fca4a4874
commit: d5a6846a1c5fc7b864b63e90d136a3af6034e37c [37/41] io_uring: improve io_get_sqe
config: hexagon-randconfig-r025-20230123 (https://download.01.org/0day-ci/archive/20230124/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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/ammarfaizi2/linux-block/commit/d5a6846a1c5fc7b864b63e90d136a3af6034e37c
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block axboe/linux-block/for-6.3/io_uring
        git checkout d5a6846a1c5fc7b864b63e90d136a3af6034e37c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

   In file included from io_uring/io_uring.c:45:
   In file included from include/linux/syscalls.h:88:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from io_uring/io_uring.c:45:
   In file included from include/linux/syscalls.h:88:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from io_uring/io_uring.c:45:
   In file included from include/linux/syscalls.h:88:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
>> io_uring/io_uring.c:2373:8: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
   static const bool io_get_sqe(struct io_ring_ctx *ctx, const struct io_uring_sqe **sqe)
          ^~~~~~
   7 warnings generated.


vim +/const +2373 io_uring/io_uring.c

  2364	
  2365	/*
  2366	 * Fetch an sqe, if one is available. Note this returns a pointer to memory
  2367	 * that is mapped by userspace. This means that care needs to be taken to
  2368	 * ensure that reads are stable, as we cannot rely on userspace always
  2369	 * being a good citizen. If members of the sqe are validated and then later
  2370	 * used, it's important that those reads are done through READ_ONCE() to
  2371	 * prevent a re-load down the line.
  2372	 */
> 2373	static const bool io_get_sqe(struct io_ring_ctx *ctx, const struct io_uring_sqe **sqe)
  2374	{
  2375		unsigned head, mask = ctx->sq_entries - 1;
  2376		unsigned sq_idx = ctx->cached_sq_head++ & mask;
  2377	
  2378		/*
  2379		 * The cached sq head (or cq tail) serves two purposes:
  2380		 *
  2381		 * 1) allows us to batch the cost of updating the user visible
  2382		 *    head updates.
  2383		 * 2) allows the kernel side to track the head on its own, even
  2384		 *    though the application is the one updating it.
  2385		 */
  2386		head = READ_ONCE(ctx->sq_array[sq_idx]);
  2387		if (likely(head < ctx->sq_entries)) {
  2388			/* double index for 128-byte SQEs, twice as long */
  2389			if (ctx->flags & IORING_SETUP_SQE128)
  2390				head <<= 1;
  2391			*sqe = &ctx->sq_sqes[head];
  2392			return true;
  2393		}
  2394	
  2395		/* drop invalid entries */
  2396		ctx->cq_extra--;
  2397		WRITE_ONCE(ctx->rings->sq_dropped,
  2398			   READ_ONCE(ctx->rings->sq_dropped) + 1);
  2399		return false;
  2400	}
  2401	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-24  2:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24  2:21 [ammarfaizi2-block:axboe/linux-block/for-6.3/io_uring 37/41] io_uring/io_uring.c:2373:8: warning: 'const' type qualifier on return type has no effect 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