public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [dhowells-fs:netfs-writeback 21/22] fs/afs/dir.c:312:9: warning: explicitly assigning value of variable of type 'ssize_t' (aka 'int') to itself
@ 2024-07-27  6:42 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-07-27  6:42 UTC (permalink / raw)
  To: David Howells; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-writeback
head:   6b24fc77cd5428445a25435f8cf7c56e55d600a6
commit: b2fd6d9020b74d49f3d0f7585cce82396b4a608e [21/22] afs: Use netfslib instead of ITER_XARRAY for directories
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20240727/202407271449.H34eCaAJ-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project ccae7b461be339e717d02f99ac857cf0bc7d17fc)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240727/202407271449.H34eCaAJ-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407271449.H34eCaAJ-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from fs/afs/dir.c:11:
   In file included from include/linux/pagemap.h:8:
   In file included from include/linux/mm.h:2221:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from fs/afs/dir.c:11:
   In file included from include/linux/pagemap.h:11:
   In file included from include/linux/highmem.h:12:
   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:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         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'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from fs/afs/dir.c:11:
   In file included from include/linux/pagemap.h:11:
   In file included from include/linux/highmem.h:12:
   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:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         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'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from fs/afs/dir.c:11:
   In file included from include/linux/pagemap.h:11:
   In file included from include/linux/highmem.h:12:
   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:14:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> fs/afs/dir.c:312:9: warning: explicitly assigning value of variable of type 'ssize_t' (aka 'int') to itself [-Wself-assign]
     312 |                                 ret = ret;
         |                                 ~~~ ^ ~~~
   8 warnings generated.


vim +312 fs/afs/dir.c

   251	
   252	/*
   253	 * Perform a read of the directory.
   254	 */
   255	static ssize_t afs_do_read_dir(struct afs_vnode *dvnode, struct file *file,
   256				       struct folio_batch *fbatch)
   257	{
   258		struct address_space *mapping = dvnode->netfs.inode.i_mapping;
   259		DEFINE_READAHEAD(ractl, file, NULL, mapping, 0);
   260		struct folio *folio;
   261		ssize_t ret = 0;
   262		size_t pos = 0;
   263		loff_t i_size;
   264	
   265		i_size = i_size_read(&dvnode->netfs.inode);
   266		if (i_size < 2048)
   267			return afs_bad(dvnode, afs_file_error_dir_small);
   268		if (i_size > 2048 * 1024) {
   269			trace_afs_file_error(dvnode, -EFBIG, afs_file_error_dir_big);
   270			return -EFBIG;
   271		}
   272	
   273		/* Lock all the folios in the range we need, filling in any gaps.  We
   274		 * drop the references we get from the VM here analogously with the VM
   275		 * readahead code.
   276		 */
   277		while (pos < i_size) {
   278			folio = filemap_get_folio(mapping, pos / PAGE_SIZE);
   279			if (IS_ERR(folio)) {
   280				fgf_t fgp_flags = FGP_LOCK | FGP_CREAT;
   281	
   282				fgp_flags |= fgf_set_order(i_size - pos);
   283	
   284				folio = __filemap_get_folio(mapping, pos / PAGE_SIZE,
   285							    fgp_flags, mapping->gfp_mask);
   286				if (IS_ERR(folio)) {
   287					ret = PTR_ERR(folio);
   288					goto revert;
   289				}
   290			}
   291	
   292			folio_clear_uptodate(folio);
   293			ractl._nr_pages += folio_nr_pages(folio);
   294			pos += folio_size(folio);
   295		}
   296	
   297		/* AFS requires us to perform the read of a directory synchronously as
   298		 * a single unit to avoid issues with the directory contents being
   299		 * changed between reads.
   300		 */
   301		ret = netfs_read_single(&ractl);
   302		if (ret >= 0) {
   303			i_size = i_size_read(&dvnode->netfs.inode);
   304			if (i_size > ret) {
   305				/* The content has grown, so we need to expand the
   306				 * buffer.
   307				 */
   308				ret = -ESTALE;
   309			} else {
   310				int ret2 = afs_dir_check(dvnode, fbatch);
   311				if (ret2 < 0)
 > 312					ret = ret;
   313			}
   314		}
   315	
   316	revert:
   317		while ((folio = readahead_folio(&ractl)) != NULL) {
   318			folio_get(folio);
   319			filemap_remove_folio(folio);
   320			folio_unlock(folio);
   321			if (!folio_batch_add(fbatch, folio))
   322				folio_batch_release(fbatch);
   323		}
   324		return ret;
   325	}
   326	

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

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

only message in thread, other threads:[~2024-07-27  6:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27  6:42 [dhowells-fs:netfs-writeback 21/22] fs/afs/dir.c:312:9: warning: explicitly assigning value of variable of type 'ssize_t' (aka 'int') to itself 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