Hi Kees, I love your patch! Perhaps something to improve: [auto build test WARNING on staging/staging-testing] [also build test WARNING on linus/master v5.14-rc3] [cannot apply to wireless-drivers-next/master wireless-drivers/master next-20210727] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Kees-Cook/Introduce-strict-memcpy-bounds-checking/20210728-053749 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 39f9137268ee3df0047706df4e9b7357a40ffc98 config: x86_64-randconfig-s022-20210728 (attached as .config) compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/0day-ci/linux/commit/d6aff26cc627e1579f89ebaaa51365cabd5c7ee3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Kees-Cook/Introduce-strict-memcpy-bounds-checking/20210728-053749 git checkout d6aff26cc627e1579f89ebaaa51365cabd5c7ee3 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem * @@ drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: expected void const * drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: got unsigned char [noderef] [usertype] __iomem * >> drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem * @@ drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: expected void const * drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: got unsigned char [noderef] [usertype] __iomem * >> drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got unsigned char [noderef] [usertype] __iomem * @@ drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: expected void * drivers/gpu/drm/gma500/framebuffer.c:293:9: sparse: got unsigned char [noderef] [usertype] __iomem * vim +293 drivers/gpu/drm/gma500/framebuffer.c 4d8d096e9ae866 Alan Cox 2011-11-03 252 4d8d096e9ae866 Alan Cox 2011-11-03 253 /** 4d8d096e9ae866 Alan Cox 2011-11-03 254 * psbfb_create - create a framebuffer 358794a29a5fe3 Lee Jones 2021-01-15 255 * @fb_helper: the framebuffer helper 4d8d096e9ae866 Alan Cox 2011-11-03 256 * @sizes: specification of the layout 4d8d096e9ae866 Alan Cox 2011-11-03 257 * 4d8d096e9ae866 Alan Cox 2011-11-03 258 * Create a framebuffer to the specifications provided 4d8d096e9ae866 Alan Cox 2011-11-03 259 */ 6b7ce2c4161a00 Thomas Zimmermann 2019-11-22 260 static int psbfb_create(struct drm_fb_helper *fb_helper, 4d8d096e9ae866 Alan Cox 2011-11-03 261 struct drm_fb_helper_surface_size *sizes) 4d8d096e9ae866 Alan Cox 2011-11-03 262 { 6b7ce2c4161a00 Thomas Zimmermann 2019-11-22 263 struct drm_device *dev = fb_helper->dev; 4d8d096e9ae866 Alan Cox 2011-11-03 264 struct drm_psb_private *dev_priv = dev->dev_private; a2c68495b57986 Thomas Zimmermann 2020-12-01 265 struct pci_dev *pdev = to_pci_dev(dev->dev); 4d8d096e9ae866 Alan Cox 2011-11-03 266 struct fb_info *info; 0a8ec2ed0783eb Thomas Zimmermann 2019-11-22 267 struct drm_framebuffer *fb; a9a644ac9e8d6c Dave Airlie 2011-11-28 268 struct drm_mode_fb_cmd2 mode_cmd; 4d8d096e9ae866 Alan Cox 2011-11-03 269 int size; 4d8d096e9ae866 Alan Cox 2011-11-03 270 int ret; 4d8d096e9ae866 Alan Cox 2011-11-03 271 struct gtt_range *backing; a9a644ac9e8d6c Dave Airlie 2011-11-28 272 u32 bpp, depth; 4d8d096e9ae866 Alan Cox 2011-11-03 273 4d8d096e9ae866 Alan Cox 2011-11-03 274 mode_cmd.width = sizes->surface_width; 4d8d096e9ae866 Alan Cox 2011-11-03 275 mode_cmd.height = sizes->surface_height; a9a644ac9e8d6c Dave Airlie 2011-11-28 276 bpp = sizes->surface_bpp; 6aa1ead1b85581 Kirill A. Shutemov 2012-03-08 277 depth = sizes->surface_depth; 4d8d096e9ae866 Alan Cox 2011-11-03 278 4d8d096e9ae866 Alan Cox 2011-11-03 279 /* No 24bit packed */ a9a644ac9e8d6c Dave Airlie 2011-11-28 280 if (bpp == 24) a9a644ac9e8d6c Dave Airlie 2011-11-28 281 bpp = 32; 4d8d096e9ae866 Alan Cox 2011-11-03 282 ebc7d6470ac4b5 Patrik Jakobsson 2020-10-28 283 mode_cmd.pitches[0] = ALIGN(mode_cmd.width * DIV_ROUND_UP(bpp, 8), 64); a6ba582d264f67 Alan Cox 2011-11-29 284 a6ba582d264f67 Alan Cox 2011-11-29 285 size = mode_cmd.pitches[0] * mode_cmd.height; a6ba582d264f67 Alan Cox 2011-11-29 286 size = ALIGN(size, PAGE_SIZE); a6ba582d264f67 Alan Cox 2011-11-29 287 4d8d096e9ae866 Alan Cox 2011-11-03 288 /* Allocate the framebuffer in the GTT with stolen page backing */ 4d8d096e9ae866 Alan Cox 2011-11-03 289 backing = psbfb_alloc(dev, size); 4d8d096e9ae866 Alan Cox 2011-11-03 290 if (backing == NULL) 4d8d096e9ae866 Alan Cox 2011-11-03 291 return -ENOMEM; 4d8d096e9ae866 Alan Cox 2011-11-03 292 bb84977941ad85 Alan Cox 2012-05-03 @293 memset(dev_priv->vram_addr + backing->offset, 0, size); bb84977941ad85 Alan Cox 2012-05-03 294 6b7ce2c4161a00 Thomas Zimmermann 2019-11-22 295 info = drm_fb_helper_alloc_fbi(fb_helper); 546187c85d4d4e Archit Taneja 2015-07-22 296 if (IS_ERR(info)) { 546187c85d4d4e Archit Taneja 2015-07-22 297 ret = PTR_ERR(info); da7bdda2afdf1a Daniel Vetter 2017-02-07 298 goto out; 4d8d096e9ae866 Alan Cox 2011-11-03 299 } 4d8d096e9ae866 Alan Cox 2011-11-03 300 a9a644ac9e8d6c Dave Airlie 2011-11-28 301 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth); a9a644ac9e8d6c Dave Airlie 2011-11-28 302 0a8ec2ed0783eb Thomas Zimmermann 2019-11-22 303 fb = psb_framebuffer_create(dev, &mode_cmd, &backing->gem); 0a8ec2ed0783eb Thomas Zimmermann 2019-11-22 304 if (IS_ERR(fb)) { 0a8ec2ed0783eb Thomas Zimmermann 2019-11-22 305 ret = PTR_ERR(fb); da7bdda2afdf1a Daniel Vetter 2017-02-07 306 goto out; 0a8ec2ed0783eb Thomas Zimmermann 2019-11-22 307 } 4d8d096e9ae866 Alan Cox 2011-11-03 308 6b7ce2c4161a00 Thomas Zimmermann 2019-11-22 309 fb_helper->fb = fb; 4d8d096e9ae866 Alan Cox 2011-11-03 310 a6ba582d264f67 Alan Cox 2011-11-29 311 info->fbops = &psbfb_unaccel_ops; 4d8d096e9ae866 Alan Cox 2011-11-03 312 4d8d096e9ae866 Alan Cox 2011-11-03 313 info->fix.smem_start = dev->mode_config.fb_base; 4d8d096e9ae866 Alan Cox 2011-11-03 314 info->fix.smem_len = size; ebc7d6470ac4b5 Patrik Jakobsson 2020-10-28 315 info->fix.ywrapstep = 0; a6ba582d264f67 Alan Cox 2011-11-29 316 info->fix.ypanstep = 0; 4d8d096e9ae866 Alan Cox 2011-11-03 317 4d8d096e9ae866 Alan Cox 2011-11-03 318 /* Accessed stolen memory directly */ 37214ca00e6474 Kirill A. Shutemov 2012-05-03 319 info->screen_base = dev_priv->vram_addr + backing->offset; 4d8d096e9ae866 Alan Cox 2011-11-03 320 info->screen_size = size; 4d8d096e9ae866 Alan Cox 2011-11-03 321 4d8d096e9ae866 Alan Cox 2011-11-03 322 if (dev_priv->gtt.stolen_size) { 4d8d096e9ae866 Alan Cox 2011-11-03 323 info->apertures->ranges[0].base = dev->mode_config.fb_base; 4d8d096e9ae866 Alan Cox 2011-11-03 324 info->apertures->ranges[0].size = dev_priv->gtt.stolen_size; 4d8d096e9ae866 Alan Cox 2011-11-03 325 } 4d8d096e9ae866 Alan Cox 2011-11-03 326 6b7ce2c4161a00 Thomas Zimmermann 2019-11-22 327 drm_fb_helper_fill_info(info, fb_helper, sizes); 4d8d096e9ae866 Alan Cox 2011-11-03 328 a2c68495b57986 Thomas Zimmermann 2020-12-01 329 info->fix.mmio_start = pci_resource_start(pdev, 0); a2c68495b57986 Thomas Zimmermann 2020-12-01 330 info->fix.mmio_len = pci_resource_len(pdev, 0); 4d8d096e9ae866 Alan Cox 2011-11-03 331 fb2a99e15ff0d3 Sascha Hauer 2012-02-06 332 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ 4d8d096e9ae866 Alan Cox 2011-11-03 333 e18da8ce7d730b Thomas Zimmermann 2019-11-22 334 dev_dbg(dev->dev, "allocated %dx%d fb\n", fb->width, fb->height); 4d8d096e9ae866 Alan Cox 2011-11-03 335 4d8d096e9ae866 Alan Cox 2011-11-03 336 return 0; da7bdda2afdf1a Daniel Vetter 2017-02-07 337 out: 4d8d096e9ae866 Alan Cox 2011-11-03 338 psb_gtt_free_range(dev, backing); 4d8d096e9ae866 Alan Cox 2011-11-03 339 return ret; 4d8d096e9ae866 Alan Cox 2011-11-03 340 } 4d8d096e9ae866 Alan Cox 2011-11-03 341 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org