Content-Type: multipart/mixed; boundary="===============6774410183847703792==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v2] proc/vmcore: fix clearing user buffer by properly using clear_user() Date: Fri, 26 Nov 2021 09:44:57 +0800 Message-ID: <202111260925.UOahu0wC-lkp@intel.com> In-Reply-To: <20211112092750.6921-1-david@redhat.com> List-Id: --===============6774410183847703792== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi David, I love your patch! Perhaps something to improve: [auto build test WARNING on debe436e77c72fcee804fb867f275e6d31aa999c] url: https://github.com/0day-ci/linux/commits/David-Hildenbrand/proc-vmc= ore-fix-clearing-user-buffer-by-properly-using-clear_user/20211112-172947 base: debe436e77c72fcee804fb867f275e6d31aa999c config: s390-randconfig-s031-20211115 (https://download.01.org/0day-ci/arch= ive/20211126/202111260925.UOahu0wC-lkp(a)intel.com/config) compiler: s390-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://github.com/0day-ci/linux/commit/c20846d5e7db81244d84acaab= 61b47462aaa8d13 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review David-Hildenbrand/proc-vmcore-fix-= clearing-user-buffer-by-properly-using-clear_user/20211112-172947 git checkout c20846d5e7db81244d84acaab61b47462aaa8d13 # save the config file to linux build tree COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=3Ds390 = If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> fs/proc/vmcore.c:161:45: sparse: sparse: incorrect type in argument 1 (d= ifferent address spaces) @@ expected void [noderef] __user *to @@ g= ot char *buf @@ fs/proc/vmcore.c:161:45: sparse: expected void [noderef] __user *to fs/proc/vmcore.c:161:45: 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 =3D 0, tmp; 142 = 143 if (!count) 144 return 0; 145 = 146 offset =3D (unsigned long)(*ppos % PAGE_SIZE); 147 pfn =3D (unsigned long)(*ppos / PAGE_SIZE); 148 = 149 down_read(&vmcore_cb_rwsem); 150 do { 151 if (count > (PAGE_SIZE - offset)) 152 nr_bytes =3D PAGE_SIZE - offset; 153 else 154 nr_bytes =3D count; 155 = 156 /* If pfn is not ram, return zeros for sparse dump files */ 157 if (!pfn_is_ram(pfn)) { 158 tmp =3D 0; 159 if (!userbuf) 160 memset(buf, 0, nr_bytes); > 161 else if (clear_user(buf, nr_bytes)) 162 tmp =3D -EFAULT; 163 } else { 164 if (encrypted) 165 tmp =3D copy_oldmem_page_encrypted(pfn, buf, 166 nr_bytes, 167 offset, 168 userbuf); 169 else 170 tmp =3D 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 +=3D nr_bytes; 179 count -=3D nr_bytes; 180 buf +=3D nr_bytes; 181 read +=3D nr_bytes; 182 ++pfn; 183 offset =3D 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 --===============6774410183847703792==--