drm/i915: check the return value from the copy from user
authorDave Airlie <airlied@redhat.com>
Sun, 29 Mar 2009 00:29:48 +0000 (20:29 -0400)
committerDave Airlie <airlied@redhat.com>
Sun, 29 Mar 2009 00:29:48 +0000 (20:29 -0400)
This produced a warning on my build, not sure why super-warning-man didn't
notice this one, its much worse than the %z one.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/i915_gem.c

index e5d2bdf2cc9b664b91d085c2db1d3358848df4ea..e0389ad1477d22f48d24931509fd522f4ac1b6ff 100644 (file)
@@ -446,13 +446,16 @@ fast_shmem_write(struct page **pages,
                 int length)
 {
        char __iomem *vaddr;
+       unsigned long unwritten;
 
        vaddr = kmap_atomic(pages[page_base >> PAGE_SHIFT], KM_USER0);
        if (vaddr == NULL)
                return -ENOMEM;
-       __copy_from_user_inatomic(vaddr + page_offset, data, length);
+       unwritten = __copy_from_user_inatomic(vaddr + page_offset, data, length);
        kunmap_atomic(vaddr, KM_USER0);
 
+       if (unwritten)
+               return -EFAULT;
        return 0;
 }