[vfs:work.aio 2/8] fs/aio.c:1127:21: warning: cast to pointer from integer of different size

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.aio
head:   12c35f0d2d3538bcd8d699a538a0b610df09f8e2
commit: 244f9488d3aaa2e7b83f501544c8126e020cda52 [2/8] keep io_event in aio_kiocb
config: i386-randconfig-x014-201909 (attached as .config)
compiler: gcc-8 (Debian 8.3.0-2) 8.3.0
reproduce:
        git checkout 244f9488d3aaa2e7b83f501544c8126e020cda52
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:331,
                    from include/linux/kernel.h:14,
                    from fs/aio.c:14:
   fs/aio.c: In function 'aio_complete':
>> fs/aio.c:1127:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       ctx, tail, iocb, (void __user *)iocb->ki_res.obj, iocb->ki_res.data,
                        ^
   include/linux/dynamic_debug.h:128:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
   fs/aio.c:1126:2: note: in expansion of macro 'pr_debug'
     pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n",
     ^~~~~~~~

vim +1127 fs/aio.c

  1093	
  1094	/* aio_complete
  1095	 *	Called when the io request on the given iocb is complete.
  1096	 */
  1097	static void aio_complete(struct aio_kiocb *iocb, long res, long res2)
  1098	{
  1099		struct kioctx	*ctx = iocb->ki_ctx;
  1100		struct aio_ring	*ring;
  1101		struct io_event	*ev_page, *event;
  1102		unsigned tail, pos, head;
  1103		unsigned long	flags;
  1104	
  1105		/*
  1106		 * Add a completion event to the ring buffer. Must be done holding
  1107		 * ctx->completion_lock to prevent other code from messing with the tail
  1108		 * pointer since we might be called from irq context.
  1109		 */
  1110		spin_lock_irqsave(&ctx->completion_lock, flags);
  1111	
  1112		tail = ctx->tail;
  1113		pos = tail + AIO_EVENTS_OFFSET;
  1114	
  1115		if (++tail >= ctx->nr_events)
  1116			tail = 0;
  1117	
  1118		ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
  1119		event = ev_page + pos % AIO_EVENTS_PER_PAGE;
  1120	
  1121		aio_fill_event(event, iocb, res, res2);
  1122	
  1123		kunmap_atomic(ev_page);
  1124		flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
  1125	
  1126		pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n",
> 1127			 ctx, tail, iocb, (void __user *)iocb->ki_res.obj, iocb->ki_res.data,
  1128			 res, res2);
  1129	
  1130		/* after flagging the request as done, we
  1131		 * must never even look at it again
  1132		 */
  1133		smp_wmb();	/* make event visible before updating tail */
  1134	
  1135		ctx->tail = tail;
  1136	
  1137		ring = kmap_atomic(ctx->ring_pages[0]);
  1138		head = ring->head;
  1139		ring->tail = tail;
  1140		kunmap_atomic(ring);
  1141		flush_dcache_page(ctx->ring_pages[0]);
  1142	
  1143		ctx->completed_events++;
  1144		if (ctx->completed_events > 1)
  1145			refill_reqs_available(ctx, head, tail);
  1146		spin_unlock_irqrestore(&ctx->completion_lock, flags);
  1147	
  1148		pr_debug("added to ring %p at [%u]\n", iocb, tail);
  1149	
  1150		/*
  1151		 * Check if the user asked us to deliver the result through an
  1152		 * eventfd. The eventfd_signal() function is safe to be called
  1153		 * from IRQ context.
  1154		 */
  1155		if (iocb->ki_eventfd) {
  1156			eventfd_signal(iocb->ki_eventfd, 1);
  1157			eventfd_ctx_put(iocb->ki_eventfd);
  1158		}
  1159	
  1160		/*
  1161		 * We have to order our ring_info tail store above and test
  1162		 * of the wait list below outside the wait lock.  This is
  1163		 * like in wake_up_bit() where clearing a bit has to be
  1164		 * ordered with the unlocked test.
  1165		 */
  1166		smp_mb();
  1167	
  1168		if (waitqueue_active(&ctx->wait))
  1169			wake_up(&ctx->wait);
  1170		iocb_put(iocb);
  1171	}
  1172	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux