lkml.org 
[lkml]   [2017]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 33/60] hyper_dmabuf: error checking on the result of dma_buf_map_attachment
Date
From: Mateusz Polrola <mateuszx.potrola@intel.com>

Added error checking on the result of function call,
dma_buf_map_attachment

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
index c0048d9..476c0d7 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
@@ -149,6 +149,11 @@ static int hyper_dmabuf_export_remote(struct file *filp, void *data)

sgt = dma_buf_map_attachment(attachment, DMA_BIDIRECTIONAL);

+ if (IS_ERR(sgt)) {
+ dev_err(hyper_dmabuf_private.device, "Cannot map attachment\n");
+ return PTR_ERR(sgt);
+ }
+
sgt_info = kcalloc(1, sizeof(*sgt_info), GFP_KERNEL);

if(!sgt_info) {
--
2.7.4
\
 
 \ /
  Last update: 2017-12-19 20:46    [W:0.191 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site