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, 3 Mar 2017 11:58:42 +0000
From:   Eric Engestrom <eric.engestrom@...tec.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
CC:     Laura Abbott <labbott@...hat.com>, <devel@...verdev.osuosl.org>,
        <romlem@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <arve@...roid.com>, <dri-devel@...ts.freedesktop.org>,
        <linux-kernel@...r.kernel.org>, <linaro-mm-sig@...ts.linaro.org>,
        <linux-mm@...ck.org>, Riley Andrews <riandrews@...roid.com>,
        Mark Brown <broonie@...nel.org>,
        Daniel Vetter <daniel.vetter@...el.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-media@...r.kernel.org>
Subject: Re: [RFC PATCH 04/12] staging: android: ion: Call dma_map_sg for
 syncing and mapping

On Friday, 2017-03-03 14:04:26 +0300, Dan Carpenter wrote:
> On Thu, Mar 02, 2017 at 01:44:36PM -0800, Laura Abbott wrote:
> >  static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
> >  					enum dma_data_direction direction)
> >  {
> >  	struct dma_buf *dmabuf = attachment->dmabuf;
> >  	struct ion_buffer *buffer = dmabuf->priv;
> > +	struct sg_table *table;
> > +	int ret;
> > +
> > +	/*
> > +	 * TODO: Need to sync wrt CPU or device completely owning?
> > +	 */
> > +
> > +	table = dup_sg_table(buffer->sg_table);
> >  
> > -	ion_buffer_sync_for_device(buffer, attachment->dev, direction);
> > -	return dup_sg_table(buffer->sg_table);
> > +	if (!dma_map_sg(attachment->dev, table->sgl, table->nents,
> > +			direction)){
> > +		ret = -ENOMEM;
> > +		goto err;
> > +	}

Actually, I think `ret` should be left uninitialised on success,
what's really missing is this return before the `err:` label:

+	return table;


> > +
> > +err:
> > +	free_duped_table(table);
> > +	return ERR_PTR(ret);
> 
> ret isn't initialized on success.
> 
> >  }
> >  
> 
> regards,
> dan carpenter

Powered by blists - more mailing lists