All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: fs/proc/vmcore.c:161:34: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Thu, 02 Dec 2021 18:47:37 +0800	[thread overview]
Message-ID: <202112021810.eF2TafOx-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58e1100fdc5990b0cc0d4beaf2562a92e621ac7d
commit: c1e63117711977cc4295b2ce73de29dd17066c82 proc/vmcore: fix clearing user buffer by properly using clear_user()
date:   12 days ago
config: sh-randconfig-s032-20211202 (https://download.01.org/0day-ci/archive/20211202/202112021810.eF2TafOx-lkp(a)intel.com/config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c1e63117711977cc4295b2ce73de29dd17066c82
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c1e63117711977cc4295b2ce73de29dd17066c82
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh SHELL=/bin/bash fs/proc/

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


sparse warnings: (new ones prefixed by >>)
>> fs/proc/vmcore.c:161:34: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] __user *__cl_addr @@     got char *buf @@
   fs/proc/vmcore.c:161:34: sparse:     expected void [noderef] __user *__cl_addr
   fs/proc/vmcore.c:161:34: sparse:     got char *buf

vim +161 fs/proc/vmcore.c

   133	
   134	/* Reads a page from the oldmem device from given offset. */
   135	ssize_t read_from_oldmem(char *buf, size_t count,
   136				 u64 *ppos, int userbuf,
   137				 bool encrypted)
   138	{
   139		unsigned long pfn, offset;
   140		size_t nr_bytes;
   141		ssize_t read = 0, tmp;
   142	
   143		if (!count)
   144			return 0;
   145	
   146		offset = (unsigned long)(*ppos % PAGE_SIZE);
   147		pfn = (unsigned long)(*ppos / PAGE_SIZE);
   148	
   149		down_read(&vmcore_cb_rwsem);
   150		do {
   151			if (count > (PAGE_SIZE - offset))
   152				nr_bytes = PAGE_SIZE - offset;
   153			else
   154				nr_bytes = count;
   155	
   156			/* If pfn is not ram, return zeros for sparse dump files */
   157			if (!pfn_is_ram(pfn)) {
   158				tmp = 0;
   159				if (!userbuf)
   160					memset(buf, 0, nr_bytes);
 > 161				else if (clear_user(buf, nr_bytes))
   162					tmp = -EFAULT;
   163			} else {
   164				if (encrypted)
   165					tmp = copy_oldmem_page_encrypted(pfn, buf,
   166									 nr_bytes,
   167									 offset,
   168									 userbuf);
   169				else
   170					tmp = copy_oldmem_page(pfn, buf, nr_bytes,
   171							       offset, userbuf);
   172			}
   173			if (tmp < 0) {
   174				up_read(&vmcore_cb_rwsem);
   175				return tmp;
   176			}
   177	
   178			*ppos += nr_bytes;
   179			count -= nr_bytes;
   180			buf += nr_bytes;
   181			read += nr_bytes;
   182			++pfn;
   183			offset = 0;
   184		} while (count);
   185	
   186		up_read(&vmcore_cb_rwsem);
   187		return read;
   188	}
   189	

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

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: fs/proc/vmcore.c:161:34: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Thu, 2 Dec 2021 18:47:37 +0800	[thread overview]
Message-ID: <202112021810.eF2TafOx-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58e1100fdc5990b0cc0d4beaf2562a92e621ac7d
commit: c1e63117711977cc4295b2ce73de29dd17066c82 proc/vmcore: fix clearing user buffer by properly using clear_user()
date:   12 days ago
config: sh-randconfig-s032-20211202 (https://download.01.org/0day-ci/archive/20211202/202112021810.eF2TafOx-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c1e63117711977cc4295b2ce73de29dd17066c82
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c1e63117711977cc4295b2ce73de29dd17066c82
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh SHELL=/bin/bash fs/proc/

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


sparse warnings: (new ones prefixed by >>)
>> fs/proc/vmcore.c:161:34: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] __user *__cl_addr @@     got char *buf @@
   fs/proc/vmcore.c:161:34: sparse:     expected void [noderef] __user *__cl_addr
   fs/proc/vmcore.c:161:34: sparse:     got char *buf

vim +161 fs/proc/vmcore.c

   133	
   134	/* Reads a page from the oldmem device from given offset. */
   135	ssize_t read_from_oldmem(char *buf, size_t count,
   136				 u64 *ppos, int userbuf,
   137				 bool encrypted)
   138	{
   139		unsigned long pfn, offset;
   140		size_t nr_bytes;
   141		ssize_t read = 0, tmp;
   142	
   143		if (!count)
   144			return 0;
   145	
   146		offset = (unsigned long)(*ppos % PAGE_SIZE);
   147		pfn = (unsigned long)(*ppos / PAGE_SIZE);
   148	
   149		down_read(&vmcore_cb_rwsem);
   150		do {
   151			if (count > (PAGE_SIZE - offset))
   152				nr_bytes = PAGE_SIZE - offset;
   153			else
   154				nr_bytes = count;
   155	
   156			/* If pfn is not ram, return zeros for sparse dump files */
   157			if (!pfn_is_ram(pfn)) {
   158				tmp = 0;
   159				if (!userbuf)
   160					memset(buf, 0, nr_bytes);
 > 161				else if (clear_user(buf, nr_bytes))
   162					tmp = -EFAULT;
   163			} else {
   164				if (encrypted)
   165					tmp = copy_oldmem_page_encrypted(pfn, buf,
   166									 nr_bytes,
   167									 offset,
   168									 userbuf);
   169				else
   170					tmp = copy_oldmem_page(pfn, buf, nr_bytes,
   171							       offset, userbuf);
   172			}
   173			if (tmp < 0) {
   174				up_read(&vmcore_cb_rwsem);
   175				return tmp;
   176			}
   177	
   178			*ppos += nr_bytes;
   179			count -= nr_bytes;
   180			buf += nr_bytes;
   181			read += nr_bytes;
   182			++pfn;
   183			offset = 0;
   184		} while (count);
   185	
   186		up_read(&vmcore_cb_rwsem);
   187		return read;
   188	}
   189	

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


             reply	other threads:[~2021-12-02 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 10:47 kernel test robot [this message]
2021-12-02 10:47 ` fs/proc/vmcore.c:161:34: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-03-08 22:29 kernel test robot

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=202112021810.eF2TafOx-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.