Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444226

Re: [PATCH 5/8] uio: fix dmem_region_start computation

From Jan Viktorin <viktorin@rehivetech.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/8] uio: fix dmem_region_start computation
Date 2016-07-15 14:10 +0200
Message-ID <rVa6m-6K7-19@gated-at.bofh.it> (permalink)
References <rV7i9-52g-5@gated-at.bofh.it> <rV7ia-52g-55@gated-at.bofh.it> <rV9Dk-6kq-7@gated-at.bofh.it>
Organization RehiveTech

Show all headers | View raw


On Fri, 15 Jul 2016 20:32:24 +0900
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> On Fri, Jul 15, 2016 at 02:34:00PM +0530, Anup Patel wrote:
> > From: Jan Viktorin <viktorin@rehivetech.com>
> > 
> > The variable i contains a total number of resources (including
> > IORESOURCE_IRQ). However, we want the dmem_region_start to point
> > after the last resource of type IORESOURCE_MEM. The original behaviour
> > leads (very likely) to skipping several UIO mapping regions and makes
> > them useless. Fix this by computing dmem_region_start from the uiomem
> > which points to the last used UIO mapping.
> > 
> > Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation")
> > 
> > Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
> > ---
> >  drivers/uio/uio_dmem_genirq.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)  
> 
> Why isn't this patch first in the series, with a stable marking, and
> your signed off on it (you are forwarding it on to me, so you need to
> add your mark to it as well, I can't take it otherwise.)
> 
> > diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
> > index 915facb..e1134a4 100644
> > --- a/drivers/uio/uio_dmem_genirq.c
> > +++ b/drivers/uio/uio_dmem_genirq.c
> > @@ -229,7 +229,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)
> >  		++uiomem;
> >  	}
> >  
> > -	priv->dmem_region_start = i;
> > +	priv->dmem_region_start = uiomem - &uioinfo->mem[0];  
> 
> Are you sure about this?  It doesn't look correct at first glance, I'm

The loop over resources counts all resources in _i_ and mem resources in _uiomem_
pointer. Thus, the dmem_region_start cannot be derived from _i_ but from _uiomem_.

> loath to take this without a bunch of testing.  Were you able to test
> this out to verify it doesn't break working hardware?

This is a good point, however, what is the working hardware? I could not find
any application of the uio_dmem_genirq anywhere online. Any example, nothing.

I am afraid that nobody is using more then 1 memory resource with this driver
and so nobody could discover this to be a bug. I was working with more then 2
resources.

I'd be glad if somebody else can test it on any other working setup.

Regards
Jan

> 
> thanks,
> 
> greg k-h

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] Cache-coherent DMA access using UIO Anup Patel <anup.patel@broadcom.com> - 2016-07-15 11:10 +0200
  [PATCH 2/8] uio: Add new UIO_MEM_PHYS_CACHE type for mem regions Anup Patel <anup.patel@broadcom.com> - 2016-07-15 11:10 +0200
  [PATCH 5/8] uio: fix dmem_region_start computation Anup Patel <anup.patel@broadcom.com> - 2016-07-15 11:10 +0200
    Re: [PATCH 5/8] uio: fix dmem_region_start computation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-07-15 13:40 +0200
      Re: [PATCH 5/8] uio: fix dmem_region_start computation Jan Viktorin <viktorin@rehivetech.com> - 2016-07-15 14:10 +0200
  [PATCH 1/8] uio: code style cleanup Anup Patel <anup.patel@broadcom.com> - 2016-07-15 11:10 +0200
  [PATCH 3/8] uio: Add new UIO_MEM_DEVICE type for mem regions Anup Patel <anup.patel@broadcom.com> - 2016-07-15 11:10 +0200

csiph-web