All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [hch-misc:set_fs-removal 14/14] drivers/pci/proc.c:56:7: warning: result of comparison of constant 4503599627370496 with expression of type 'unsigned int' is always true
Date: Thu, 03 Sep 2020 18:29:39 +0800	[thread overview]
Message-ID: <202009031832.HUJfLRT2%lkp@intel.com> (raw)

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

tree:   git://git.infradead.org/users/hch/misc.git set_fs-removal
head:   916d3a255939d055cd4cbe1953f4a195f6aa3b0d
commit: 916d3a255939d055cd4cbe1953f4a195f6aa3b0d [14/14] powerpc: remove address space overrides using set_fs()
config: powerpc-randconfig-r035-20200902 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1284dc34abd11ce4275ad21c0470ad8c679b59b7)
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 powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        git checkout 916d3a255939d055cd4cbe1953f4a195f6aa3b0d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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 >>):

>> drivers/pci/proc.c:56:7: warning: result of comparison of constant 4503599627370496 with expression of type 'unsigned int' is always true [-Wtautological-constant-out-of-range-compare]
           if (!access_ok(buf, cnt))
                ^~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/uaccess.h:35:3: note: expanded from macro 'access_ok'
            __access_ok((unsigned long)(addr), (size)))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/uaccess.h:20:32: note: expanded from macro '__access_ok'
           (addr < TASK_SIZE_MAX && size < TASK_SIZE_MAX)
                                    ~~~~ ^ ~~~~~~~~~~~~~
   1 warning generated.
--
   kernel//sched/core.c:2380:6: warning: no previous prototype for function 'sched_set_stop_task' [-Wmissing-prototypes]
   void sched_set_stop_task(int cpu, struct task_struct *stop)
        ^
   kernel//sched/core.c:2380:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void sched_set_stop_task(int cpu, struct task_struct *stop)
   ^
   static 
   kernel//sched/core.c:4635:35: warning: no previous prototype for function 'schedule_user' [-Wmissing-prototypes]
   asmlinkage __visible void __sched schedule_user(void)
                                     ^
   kernel//sched/core.c:4635:22: note: declare 'static' if the function is not intended to be used outside of this translation unit
   asmlinkage __visible void __sched schedule_user(void)
                        ^
                        static 
>> kernel//sched/core.c:5811:7: warning: result of comparison of constant 4503599627370496 with expression of type 'unsigned int' is always true [-Wtautological-constant-out-of-range-compare]
           if (!access_ok(uattr, usize))
                ^~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/uaccess.h:35:3: note: expanded from macro 'access_ok'
            __access_ok((unsigned long)(addr), (size)))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/uaccess.h:20:32: note: expanded from macro '__access_ok'
           (addr < TASK_SIZE_MAX && size < TASK_SIZE_MAX)
                                    ~~~~ ^ ~~~~~~~~~~~~~
   3 warnings generated.

git remote add hch-misc git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc set_fs-removal
git checkout 916d3a255939d055cd4cbe1953f4a195f6aa3b0d
vim +56 drivers/pci/proc.c

^1da177e4c3f415 Linus Torvalds  2005-04-16   27  
3c78bc61f5ef3bc Ryan Desfosses  2014-04-18   28  static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
3c78bc61f5ef3bc Ryan Desfosses  2014-04-18   29  				 size_t nbytes, loff_t *ppos)
^1da177e4c3f415 Linus Torvalds  2005-04-16   30  {
d9dda78bad87959 Al Viro         2013-03-31   31  	struct pci_dev *dev = PDE_DATA(file_inode(file));
^1da177e4c3f415 Linus Torvalds  2005-04-16   32  	unsigned int pos = *ppos;
^1da177e4c3f415 Linus Torvalds  2005-04-16   33  	unsigned int cnt, size;
^1da177e4c3f415 Linus Torvalds  2005-04-16   34  
^1da177e4c3f415 Linus Torvalds  2005-04-16   35  	/*
^1da177e4c3f415 Linus Torvalds  2005-04-16   36  	 * Normal users can read only the standardized portion of the
^1da177e4c3f415 Linus Torvalds  2005-04-16   37  	 * configuration space as several chips lock up when trying to read
^1da177e4c3f415 Linus Torvalds  2005-04-16   38  	 * undefined locations (think of Intel PIIX4 as a typical example).
^1da177e4c3f415 Linus Torvalds  2005-04-16   39  	 */
^1da177e4c3f415 Linus Torvalds  2005-04-16   40  
^1da177e4c3f415 Linus Torvalds  2005-04-16   41  	if (capable(CAP_SYS_ADMIN))
d9dda78bad87959 Al Viro         2013-03-31   42  		size = dev->cfg_size;
^1da177e4c3f415 Linus Torvalds  2005-04-16   43  	else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
^1da177e4c3f415 Linus Torvalds  2005-04-16   44  		size = 128;
^1da177e4c3f415 Linus Torvalds  2005-04-16   45  	else
^1da177e4c3f415 Linus Torvalds  2005-04-16   46  		size = 64;
^1da177e4c3f415 Linus Torvalds  2005-04-16   47  
^1da177e4c3f415 Linus Torvalds  2005-04-16   48  	if (pos >= size)
^1da177e4c3f415 Linus Torvalds  2005-04-16   49  		return 0;
^1da177e4c3f415 Linus Torvalds  2005-04-16   50  	if (nbytes >= size)
^1da177e4c3f415 Linus Torvalds  2005-04-16   51  		nbytes = size;
^1da177e4c3f415 Linus Torvalds  2005-04-16   52  	if (pos + nbytes > size)
^1da177e4c3f415 Linus Torvalds  2005-04-16   53  		nbytes = size - pos;
^1da177e4c3f415 Linus Torvalds  2005-04-16   54  	cnt = nbytes;
^1da177e4c3f415 Linus Torvalds  2005-04-16   55  
96d4f267e40f950 Linus Torvalds  2019-01-03  @56  	if (!access_ok(buf, cnt))
^1da177e4c3f415 Linus Torvalds  2005-04-16   57  		return -EINVAL;
^1da177e4c3f415 Linus Torvalds  2005-04-16   58  
b3c32c4f9565f93 Huang Ying      2012-10-25   59  	pci_config_pm_runtime_get(dev);
b3c32c4f9565f93 Huang Ying      2012-10-25   60  
^1da177e4c3f415 Linus Torvalds  2005-04-16   61  	if ((pos & 1) && cnt) {
^1da177e4c3f415 Linus Torvalds  2005-04-16   62  		unsigned char val;
e04b0ea2e0f9c1b Brian King      2005-09-27   63  		pci_user_read_config_byte(dev, pos, &val);
^1da177e4c3f415 Linus Torvalds  2005-04-16   64  		__put_user(val, buf);
^1da177e4c3f415 Linus Torvalds  2005-04-16   65  		buf++;
^1da177e4c3f415 Linus Torvalds  2005-04-16   66  		pos++;
^1da177e4c3f415 Linus Torvalds  2005-04-16   67  		cnt--;
^1da177e4c3f415 Linus Torvalds  2005-04-16   68  	}
^1da177e4c3f415 Linus Torvalds  2005-04-16   69  
^1da177e4c3f415 Linus Torvalds  2005-04-16   70  	if ((pos & 3) && cnt > 2) {
^1da177e4c3f415 Linus Torvalds  2005-04-16   71  		unsigned short val;
e04b0ea2e0f9c1b Brian King      2005-09-27   72  		pci_user_read_config_word(dev, pos, &val);
f17a077e61b627e Harvey Harrison 2008-07-22   73  		__put_user(cpu_to_le16(val), (__le16 __user *) buf);
^1da177e4c3f415 Linus Torvalds  2005-04-16   74  		buf += 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   75  		pos += 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   76  		cnt -= 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   77  	}
^1da177e4c3f415 Linus Torvalds  2005-04-16   78  
^1da177e4c3f415 Linus Torvalds  2005-04-16   79  	while (cnt >= 4) {
^1da177e4c3f415 Linus Torvalds  2005-04-16   80  		unsigned int val;
e04b0ea2e0f9c1b Brian King      2005-09-27   81  		pci_user_read_config_dword(dev, pos, &val);
f17a077e61b627e Harvey Harrison 2008-07-22   82  		__put_user(cpu_to_le32(val), (__le32 __user *) buf);
^1da177e4c3f415 Linus Torvalds  2005-04-16   83  		buf += 4;
^1da177e4c3f415 Linus Torvalds  2005-04-16   84  		pos += 4;
^1da177e4c3f415 Linus Torvalds  2005-04-16   85  		cnt -= 4;
^1da177e4c3f415 Linus Torvalds  2005-04-16   86  	}
^1da177e4c3f415 Linus Torvalds  2005-04-16   87  
^1da177e4c3f415 Linus Torvalds  2005-04-16   88  	if (cnt >= 2) {
^1da177e4c3f415 Linus Torvalds  2005-04-16   89  		unsigned short val;
e04b0ea2e0f9c1b Brian King      2005-09-27   90  		pci_user_read_config_word(dev, pos, &val);
f17a077e61b627e Harvey Harrison 2008-07-22   91  		__put_user(cpu_to_le16(val), (__le16 __user *) buf);
^1da177e4c3f415 Linus Torvalds  2005-04-16   92  		buf += 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   93  		pos += 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   94  		cnt -= 2;
^1da177e4c3f415 Linus Torvalds  2005-04-16   95  	}
^1da177e4c3f415 Linus Torvalds  2005-04-16   96  
^1da177e4c3f415 Linus Torvalds  2005-04-16   97  	if (cnt) {
^1da177e4c3f415 Linus Torvalds  2005-04-16   98  		unsigned char val;
e04b0ea2e0f9c1b Brian King      2005-09-27   99  		pci_user_read_config_byte(dev, pos, &val);
^1da177e4c3f415 Linus Torvalds  2005-04-16  100  		__put_user(val, buf);
^1da177e4c3f415 Linus Torvalds  2005-04-16  101  		buf++;
^1da177e4c3f415 Linus Torvalds  2005-04-16  102  		pos++;
^1da177e4c3f415 Linus Torvalds  2005-04-16  103  		cnt--;
^1da177e4c3f415 Linus Torvalds  2005-04-16  104  	}
^1da177e4c3f415 Linus Torvalds  2005-04-16  105  
b3c32c4f9565f93 Huang Ying      2012-10-25  106  	pci_config_pm_runtime_put(dev);
b3c32c4f9565f93 Huang Ying      2012-10-25  107  
^1da177e4c3f415 Linus Torvalds  2005-04-16  108  	*ppos = pos;
^1da177e4c3f415 Linus Torvalds  2005-04-16  109  	return nbytes;
^1da177e4c3f415 Linus Torvalds  2005-04-16  110  }
^1da177e4c3f415 Linus Torvalds  2005-04-16  111  

:::::: The code at line 56 was first introduced by commit
:::::: 96d4f267e40f9509e8a66e2b39e8b95655617693 Remove 'type' argument from access_ok() function

:::::: TO: Linus Torvalds <torvalds@linux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

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

                 reply	other threads:[~2020-09-03 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202009031832.HUJfLRT2%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.