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:   Fri, 24 May 2019 11:57:04 +0000
From:   Thomas Hellstrom <thellstrom@...are.com>
To:     "hch@....de" <hch@....de>, "cai@....pw" <cai@....pw>
CC:     "daniel@...ll.ch" <daniel@...ll.ch>,
        "robin.murphy@....com" <robin.murphy@....com>,
        "m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        Linux-graphics-maintainer <Linux-graphics-maintainer@...are.com>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/vmwgfx: fix a warning due to missing dma_parms

On Fri, 2019-05-24 at 08:19 +0200, Christoph Hellwig wrote:
> On Thu, May 23, 2019 at 10:37:19PM -0400, Qian Cai wrote:
> > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > index bf6c3500d363..5c567b81174f 100644
> > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > @@ -747,6 +747,13 @@ static int vmw_driver_load(struct drm_device
> > *dev, unsigned long chipset)
> >  	if (unlikely(ret != 0))
> >  		goto out_err0;
> >  
> > +	dev->dev->dma_parms =  kzalloc(sizeof(*dev->dev->dma_parms),
> > +				       GFP_KERNEL);
> > +	if (!dev->dev->dma_parms)
> > +		goto out_err0;
> 
> What bus does this device come from?  I though vmgfx was a
> (virtualized)
> PCI device, in which case this should be provided by the PCI core.
> Or are we calling DMA mapping routines on arbitrary other struct
> device,
> in which case that is the real bug and we should switch the PCI
> device
> instead.

It's a PCI device. The struct device * used in dma_map_sg() is the same
as the &pci_dev->dev handed to the probe() callback. But at probe time,
the struct device::dma_parms is non-NULL, at least on my system so
there shouldn't really be a need to kzalloc() it.

> 
> > +	dma_set_max_seg_size(dev->dev, *dev->dev->dma_mask);

The max is U32_MAX.

/Thomas


> 
> That looks odd.  If you want to support an unlimited segment size
> just pass UINT_MAX here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ