Re: [PATCH] drivers: char: mem: Fix thinko in kmem address checks

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

 



Hi Robin,

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on v4.10-rc2 next-20170104]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Robin-Murphy/drivers-char-mem-Fix-thinko-in-kmem-address-checks/20170104-235754
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=tile 

All warnings (new ones prefixed by >>):

   drivers/char/mem.c: In function 'read_kmem':
>> drivers/char/mem.c:384:2: warning: passing argument 1 of 'kaddr_to_pfn' makes pointer from integer without a cast [enabled by default]
   arch/tile/include/asm/page.h:281:29: note: expected 'const volatile void *' but argument is of type 'long unsigned int'
   drivers/char/mem.c: In function 'write_kmem':
   drivers/char/mem.c:515:2: warning: passing argument 1 of 'kaddr_to_pfn' makes pointer from integer without a cast [enabled by default]
   arch/tile/include/asm/page.h:281:29: note: expected 'const volatile void *' but argument is of type 'long unsigned int'

vim +/kaddr_to_pfn +384 drivers/char/mem.c

   368	
   369		vma->vm_pgoff = pfn;
   370		return mmap_mem(file, vma);
   371	}
   372	
   373	/*
   374	 * This function reads the *virtual* memory as seen by the kernel.
   375	 */
   376	static ssize_t read_kmem(struct file *file, char __user *buf,
   377				 size_t count, loff_t *ppos)
   378	{
   379		unsigned long p = *ppos;
   380		ssize_t low_count, read, sz;
   381		char *kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
   382		int err = 0;
   383	
 > 384		if (!virt_addr_valid(p))
   385			return -EIO;
   386	
   387		read = 0;
   388		if (p < (unsigned long) high_memory) {
   389			low_count = count;
   390			if (count > (unsigned long)high_memory - p)
   391				low_count = (unsigned long)high_memory - p;
   392	

---
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 Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]