All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] udmabuf: fix error code in map_udmabuf()
@ 2018-09-14  6:56 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-14  6:56 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Sumit Semwal, dri-devel, linux-media, linaro-mm-sig, kernel-janitors

We accidentally forgot to set "ret" on this error path so it means we
return NULL instead of an error pointer.  The caller checks for NULL and
changes it to an error pointer so it doesn't cause an issue at run time.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 9edabce0b8ab..5b44ef226904 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -61,8 +61,10 @@ static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
 					GFP_KERNEL);
 	if (ret < 0)
 		goto err;
-	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction)) {
+		ret = -EINVAL;
 		goto err;
+	}
 	return sg;
 
 err:

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] udmabuf: fix error code in map_udmabuf()
@ 2018-09-14  6:56 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-14  6:56 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: linaro-mm-sig, kernel-janitors, dri-devel, linux-media

We accidentally forgot to set "ret" on this error path so it means we
return NULL instead of an error pointer.  The caller checks for NULL and
changes it to an error pointer so it doesn't cause an issue at run time.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 9edabce0b8ab..5b44ef226904 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -61,8 +61,10 @@ static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
 					GFP_KERNEL);
 	if (ret < 0)
 		goto err;
-	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction)) {
+		ret = -EINVAL;
 		goto err;
+	}
 	return sg;
 
 err:

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] udmabuf: fix error code in map_udmabuf()
@ 2018-09-14  6:56 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-09-14  6:56 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: linaro-mm-sig, kernel-janitors, dri-devel, linux-media

We accidentally forgot to set "ret" on this error path so it means we
return NULL instead of an error pointer.  The caller checks for NULL and
changes it to an error pointer so it doesn't cause an issue at run time.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 9edabce0b8ab..5b44ef226904 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -61,8 +61,10 @@ static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
 					GFP_KERNEL);
 	if (ret < 0)
 		goto err;
-	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction)) {
+		ret = -EINVAL;
 		goto err;
+	}
 	return sg;
 
 err:
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] udmabuf: fix error code in map_udmabuf()
  2018-09-14  6:56 ` Dan Carpenter
  (?)
@ 2018-09-14  9:45   ` Gerd Hoffmann
  -1 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2018-09-14  9:45 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sumit Semwal, dri-devel, linux-media, linaro-mm-sig, kernel-janitors

On Fri, Sep 14, 2018 at 09:56:15AM +0300, Dan Carpenter wrote:
> We accidentally forgot to set "ret" on this error path so it means we
> return NULL instead of an error pointer.  The caller checks for NULL and
> changes it to an error pointer so it doesn't cause an issue at run time.

Pushed to drm-misc-next.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] udmabuf: fix error code in map_udmabuf()
@ 2018-09-14  9:45   ` Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2018-09-14  9:45 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linaro-mm-sig, kernel-janitors, dri-devel, linux-media

On Fri, Sep 14, 2018 at 09:56:15AM +0300, Dan Carpenter wrote:
> We accidentally forgot to set "ret" on this error path so it means we
> return NULL instead of an error pointer.  The caller checks for NULL and
> changes it to an error pointer so it doesn't cause an issue at run time.

Pushed to drm-misc-next.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] udmabuf: fix error code in map_udmabuf()
@ 2018-09-14  9:45   ` Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2018-09-14  9:45 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linaro-mm-sig, kernel-janitors, dri-devel, linux-media

On Fri, Sep 14, 2018 at 09:56:15AM +0300, Dan Carpenter wrote:
> We accidentally forgot to set "ret" on this error path so it means we
> return NULL instead of an error pointer.  The caller checks for NULL and
> changes it to an error pointer so it doesn't cause an issue at run time.

Pushed to drm-misc-next.

thanks,
  Gerd

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-14 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-14  6:56 [PATCH] udmabuf: fix error code in map_udmabuf() Dan Carpenter
2018-09-14  6:56 ` Dan Carpenter
2018-09-14  6:56 ` Dan Carpenter
2018-09-14  9:45 ` Gerd Hoffmann
2018-09-14  9:45   ` Gerd Hoffmann
2018-09-14  9:45   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.