[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1495764970-2951-1-git-send-email-jeffy.chen@rock-chips.com>
Date: Fri, 26 May 2017 10:16:10 +0800
From: Jeffy Chen <jeffy.chen@...k-chips.com>
To: linux-kernel@...r.kernel.org
Cc: seanpaul@...omium.org, tfiga@...omium.org,
Jeffy Chen <jeffy.chen@...k-chips.com>
Subject: [PATCH v2] drm/rockchip: Don't allow zero sized gem buffer
Currently we only call this from dumb_create, which would guarantee the
size is non-zero.
But it would be harmless to add a sanity check for it for further
extension.
This is much the same as:
1a5dff5 drm/msm: Don't allow zero sized buffer objects
v2: Rewrite commit message.
Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
---
Changes in v2:
Rewrite commit message.
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index df9e570..8917922 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -315,6 +315,11 @@ struct rockchip_gem_object *
struct drm_gem_object *obj;
int ret;
+ if (!size) {
+ DRM_ERROR("gem buffer size is zero\n");
+ return ERR_PTR(-EINVAL);
+ }
+
size = round_up(size, PAGE_SIZE);
rk_obj = kzalloc(sizeof(*rk_obj), GFP_KERNEL);
--
2.1.4
Powered by blists - more mailing lists