mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [bvanassche:configfs 6/6] fs/configfs/file.c:289:57: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int')
@ 2021-07-23 12:13 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-23 12:13 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: clang-built-linux, kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4122 bytes --]

tree:   https://github.com/bvanassche/linux configfs
head:   7e2353f58cd57892a51ad80a600b481b22ef775a
commit: 7e2353f58cd57892a51ad80a600b481b22ef775a [6/6] wip2
config: mips-randconfig-r013-20210723 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40)
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
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/bvanassche/linux/commit/7e2353f58cd57892a51ad80a600b481b22ef775a
        git remote add bvanassche https://github.com/bvanassche/linux
        git fetch --no-tags bvanassche configfs
        git checkout 7e2353f58cd57892a51ad80a600b481b22ef775a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>):

>> fs/configfs/file.c:289:57: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
           pr_info("%s: end_offset = %ld; len = %ld\n", __func__, end_offset, len);
                                     ~~~                          ^~~~~~~~~~
                                     %u
   include/linux/printk.h:420:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
>> fs/configfs/file.c:289:69: warning: format specifies type 'long' but the argument has type 'ssize_t' (aka 'int') [-Wformat]
           pr_info("%s: end_offset = %ld; len = %ld\n", __func__, end_offset, len);
                                                ~~~                           ^~~
                                                %d
   include/linux/printk.h:420:34: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                   ~~~     ^~~~~~~~~~~
   2 warnings generated.


vim +289 fs/configfs/file.c

   240	
   241	static ssize_t configfs_bin_write_iter(struct kiocb *iocb,
   242					       struct iov_iter *from)
   243	{
   244		struct file *file = iocb->ki_filp;
   245		struct configfs_buffer *buffer = file->private_data;
   246		void *tbuf = NULL;
   247		size_t end_offset;
   248		ssize_t len;
   249	
   250		mutex_lock(&buffer->mutex);
   251	
   252		/* we don't support switching read/write modes */
   253		if (buffer->read_in_progress) {
   254			len = -ETXTBSY;
   255			goto out;
   256		}
   257		buffer->write_in_progress = true;
   258	
   259		/* buffer grows? */
   260		end_offset = iocb->ki_pos + iov_iter_count(from);
   261		if (end_offset > buffer->bin_buffer_size) {
   262			if (buffer->cb_max_size && end_offset > buffer->cb_max_size) {
   263				len = -EFBIG;
   264				goto out;
   265			}
   266	
   267			tbuf = vmalloc(end_offset);
   268			if (tbuf == NULL) {
   269				len = -ENOMEM;
   270				goto out;
   271			}
   272	
   273			/* copy old contents */
   274			if (buffer->bin_buffer) {
   275				memcpy(tbuf, buffer->bin_buffer,
   276					buffer->bin_buffer_size);
   277				vfree(buffer->bin_buffer);
   278			}
   279	
   280			/* clear the new area */
   281			memset(tbuf + buffer->bin_buffer_size, 0,
   282				end_offset - buffer->bin_buffer_size);
   283			buffer->bin_buffer = tbuf;
   284			buffer->bin_buffer_size = end_offset;
   285		}
   286	
   287		len = copy_from_iter(buffer->bin_buffer + iocb->ki_pos,
   288				     buffer->bin_buffer_size - iocb->ki_pos, from);
 > 289		pr_info("%s: end_offset = %ld; len = %ld\n", __func__, end_offset, len);
   290		iocb->ki_pos += len;
   291	out:
   292		mutex_unlock(&buffer->mutex);
   293		return len ? : -EFAULT;
   294	}
   295	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35057 bytes --]

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

only message in thread, other threads:[~2021-07-23 12:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 12:13 [bvanassche:configfs 6/6] fs/configfs/file.c:289:57: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') 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

all inboxes | Powered by JetHome®