diff options
author | Dave Airlie <airlied@redhat.com> | 2012-05-23 10:46:24 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-23 10:46:24 +0100 |
commit | 5b2ba70091c1bef1dfb3677db229dc5392dfec8c (patch) | |
tree | 903797b4e09b9444450fb35b4101c1fd9b8530b0 /drivers/gpu/drm/udl/udl_fb.c | |
parent | 4d93914ae3db4a897ead4b1e33eca7cdfff4c6f7 (diff) | |
parent | 40f5cf996991577ec65d36cd3599cca7ec5d87d3 (diff) |
Merge branch 'prime-merge' of ssh://people.freedesktop.org/~airlied/linux into drm-core-next
* 'prime-merge' of ssh://people.freedesktop.org/~airlied/linux:
drm/radeon: add PRIME support (v2)
i915: add dmabuf/prime buffer sharing support.
nouveau: add PRIME support
ttm: add prime sharing support to TTM (v2)
udl: add prime fd->handle support.
drm/prime: add exported buffers to current fprivs imported buffer list (v2)
drm/prime: introduce sg->pages/addr arrays helper
Diffstat (limited to 'drivers/gpu/drm/udl/udl_fb.c')
-rw-r--r-- | drivers/gpu/drm/udl/udl_fb.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index 4d9c3a5d8a45..a029ee39b0c5 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c @@ -593,11 +593,20 @@ udl_fb_user_fb_create(struct drm_device *dev, struct drm_gem_object *obj; struct udl_framebuffer *ufb; int ret; + uint32_t size; obj = drm_gem_object_lookup(dev, file, mode_cmd->handles[0]); if (obj == NULL) return ERR_PTR(-ENOENT); + size = mode_cmd->pitches[0] * mode_cmd->height; + size = ALIGN(size, PAGE_SIZE); + + if (size > obj->size) { + DRM_ERROR("object size not sufficient for fb %d %zu %d %d\n", size, obj->size, mode_cmd->pitches[0], mode_cmd->height); + return ERR_PTR(-ENOMEM); + } + ufb = kzalloc(sizeof(*ufb), GFP_KERNEL); if (ufb == NULL) return ERR_PTR(-ENOMEM); |