lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 May 2018 20:46:18 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Souptick Joarder <jrdr.linux@...il.com>
Cc:     kbuild-all@...org, tomi.valkeinen@...com, airlied@...ux.ie,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        willy@...radead.org
Subject: Re: [PATCH] gpu: drm: omapdrm: Adding new typedef vm_fault_t

Hi Souptick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.17-rc6 next-20180517]
[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/Souptick-Joarder/gpu-drm-omapdrm-Adding-new-typedef-vm_fault_t/20180522-135920
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/gpu//drm/omapdrm/omap_gem.c: In function 'fault_2d':
   drivers/gpu//drm/omapdrm/omap_gem.c:480:9: error: implicit declaration of function 'vmf_error'; did you mean '__pmd_error'? [-Werror=implicit-function-declaration]
      ret = vmf_error(err);
            ^~~~~~~~~
            __pmd_error
>> drivers/gpu//drm/omapdrm/omap_gem.c:503:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return ret;
            ^~~
   cc1: some warnings being treated as errors

vim +/ret +503 drivers/gpu//drm/omapdrm/omap_gem.c

   398	
   399	/* Special handling for the case of faulting in 2d tiled buffers */
   400	static vm_fault_t fault_2d(struct drm_gem_object *obj,
   401			struct vm_area_struct *vma, struct vm_fault *vmf)
   402	{
   403		struct omap_gem_object *omap_obj = to_omap_bo(obj);
   404		struct omap_drm_private *priv = obj->dev->dev_private;
   405		struct omap_drm_usergart_entry *entry;
   406		enum tiler_fmt fmt = gem2fmt(omap_obj->flags);
   407		struct page *pages[64];  /* XXX is this too much to have on stack? */
   408		unsigned long pfn;
   409		pgoff_t pgoff, base_pgoff;
   410		unsigned long vaddr;
   411		int i, err, slots;
   412		vm_fault_t ret;
   413	
   414		/*
   415		 * Note the height of the slot is also equal to the number of pages
   416		 * that need to be mapped in to fill 4kb wide CPU page.  If the slot
   417		 * height is 64, then 64 pages fill a 4kb wide by 64 row region.
   418		 */
   419		const int n = priv->usergart[fmt].height;
   420		const int n_shift = priv->usergart[fmt].height_shift;
   421	
   422		/*
   423		 * If buffer width in bytes > PAGE_SIZE then the virtual stride is
   424		 * rounded up to next multiple of PAGE_SIZE.. this need to be taken
   425		 * into account in some of the math, so figure out virtual stride
   426		 * in pages
   427		 */
   428		const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE);
   429	
   430		/* We don't use vmf->pgoff since that has the fake offset: */
   431		pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
   432	
   433		/*
   434		 * Actual address we start mapping at is rounded down to previous slot
   435		 * boundary in the y direction:
   436		 */
   437		base_pgoff = round_down(pgoff, m << n_shift);
   438	
   439		/* figure out buffer width in slots */
   440		slots = omap_obj->width >> priv->usergart[fmt].slot_shift;
   441	
   442		vaddr = vmf->address - ((pgoff - base_pgoff) << PAGE_SHIFT);
   443	
   444		entry = &priv->usergart[fmt].entry[priv->usergart[fmt].last];
   445	
   446		/* evict previous buffer using this usergart entry, if any: */
   447		if (entry->obj)
   448			evict_entry(entry->obj, fmt, entry);
   449	
   450		entry->obj = obj;
   451		entry->obj_pgoff = base_pgoff;
   452	
   453		/* now convert base_pgoff to phys offset from virt offset: */
   454		base_pgoff = (base_pgoff >> n_shift) * slots;
   455	
   456		/* for wider-than 4k.. figure out which part of the slot-row we want: */
   457		if (m > 1) {
   458			int off = pgoff % m;
   459			entry->obj_pgoff += off;
   460			base_pgoff /= m;
   461			slots = min(slots - (off << n_shift), n);
   462			base_pgoff += off << n_shift;
   463			vaddr += off << PAGE_SHIFT;
   464		}
   465	
   466		/*
   467		 * Map in pages. Beyond the valid pixel part of the buffer, we set
   468		 * pages[i] to NULL to get a dummy page mapped in.. if someone
   469		 * reads/writes it they will get random/undefined content, but at
   470		 * least it won't be corrupting whatever other random page used to
   471		 * be mapped in, or other undefined behavior.
   472		 */
   473		memcpy(pages, &omap_obj->pages[base_pgoff],
   474				sizeof(struct page *) * slots);
   475		memset(pages + slots, 0,
   476				sizeof(struct page *) * (n - slots));
   477	
   478		err = tiler_pin(entry->block, pages, ARRAY_SIZE(pages), 0, true);
   479		if (err) {
 > 480			ret = vmf_error(err);
   481			dev_err(obj->dev->dev, "failed to pin: %d\n", err);
   482			return ret;
   483		}
   484	
   485		pfn = entry->dma_addr >> PAGE_SHIFT;
   486	
   487		VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
   488				pfn, pfn << PAGE_SHIFT);
   489	
   490		for (i = n; i > 0; i--) {
   491			ret = vmf_insert_mixed(vma,
   492				vaddr, __pfn_to_pfn_t(pfn, PFN_DEV));
   493			if (ret & VM_FAULT_ERROR)
   494				break;
   495			pfn += priv->usergart[fmt].stride_pfn;
   496			vaddr += PAGE_SIZE * m;
   497		}
   498	
   499		/* simple round-robin: */
   500		priv->usergart[fmt].last = (priv->usergart[fmt].last + 1)
   501					 % NUM_USERGART_ENTRIES;
   502	
 > 503		return ret;
   504	}
   505	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (33601 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ