Skip to content

Commit

Permalink
Merge branch 'drm-fixes' of git://people.freedesktop.org/~dvdhrm/linu…
Browse files Browse the repository at this point in the history
…x into drm-next

This branch includes 6 minor fixes mainly for udl. Everything non-trivial was
reviewed by Daniel and the patches have been on the list for quite some time.

* 'drm-fixes' of git://people.freedesktop.org/~dvdhrm/linux:
  drm/gem: dont init "ret" in drm_gem_mmap()
  drm/crtc: add sanity checks to create_dumb()
  drm/gem: free vma-node during object-cleanup
  drm/gem: fix indentation
  drm/udl: fix Bpp calculation in dumb_create()
  drm/udl: fix error-path when damage-req fails
  • Loading branch information
Dave Airlie committed Mar 17, 2014
2 parents 786a782 + a8469aa commit 28b90a9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
17 changes: 17 additions & 0 deletions drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3784,9 +3784,26 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
struct drm_mode_create_dumb *args = data;
u32 cpp, stride, size;

if (!dev->driver->dumb_create)
return -ENOSYS;
if (!args->width || !args->height || !args->bpp)
return -EINVAL;

/* overflow checks for 32bit size calculations */
cpp = DIV_ROUND_UP(args->bpp, 8);
if (cpp > 0xffffffffU / args->width)
return -EINVAL;
stride = cpp * args->width;
if (args->height > 0xffffffffU / stride)
return -EINVAL;

/* test for wrap-around */
size = args->height * stride;
if (PAGE_ALIGN(size) == 0)
return -EINVAL;

return dev->driver->dumb_create(file_priv, dev, args);
}

Expand Down
8 changes: 5 additions & 3 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,9 @@ drm_gem_object_release(struct drm_gem_object *obj)
WARN_ON(obj->dma_buf);

if (obj->filp)
fput(obj->filp);
fput(obj->filp);

drm_gem_free_mmap_offset(obj);
}
EXPORT_SYMBOL(drm_gem_object_release);

Expand Down Expand Up @@ -782,7 +784,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
vma->vm_ops = dev->driver->gem_vm_ops;
vma->vm_private_data = obj;
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));

/* Take a ref for this mapping of the object, so that the fault
* handler can dereference the mmap offset's pointer to the object.
Expand Down Expand Up @@ -818,7 +820,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
struct drm_device *dev = priv->minor->dev;
struct drm_gem_object *obj;
struct drm_vma_offset_node *node;
int ret = 0;
int ret;

if (drm_device_is_unplugged(dev))
return -ENODEV;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/udl/udl_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
clips[i].x2 - clips[i].x1,
clips[i].y2 - clips[i].y1);
if (ret)
goto unlock;
break;
}

if (ufb->obj->base.import_attach) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/udl/udl_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int udl_dumb_create(struct drm_file *file,
struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
args->pitch = args->width * ((args->bpp + 1) / 8);
args->pitch = args->width * DIV_ROUND_UP(args->bpp, 8);
args->size = args->pitch * args->height;
return udl_gem_create(file, dev,
args->size, &args->handle);
Expand Down

0 comments on commit 28b90a9

Please sign in to comment.