Commit f5a69404 authored by Dave Airlie's avatar Dave Airlie

Add some missing NULL->0 and __user annotiations

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent b770261a
...@@ -429,7 +429,7 @@ static int i915_dispatch_batchbuffer(drm_device_t * dev, ...@@ -429,7 +429,7 @@ static int i915_dispatch_batchbuffer(drm_device_t * dev,
drm_i915_batchbuffer_t * batch) drm_i915_batchbuffer_t * batch)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_clip_rect_t *boxes = batch->cliprects; drm_clip_rect_t __user *boxes = batch->cliprects;
int nbox = batch->num_cliprects; int nbox = batch->num_cliprects;
int i = 0, count; int i = 0, count;
RING_LOCALS; RING_LOCALS;
......
...@@ -80,7 +80,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size, ...@@ -80,7 +80,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start; newblock->start = start;
newblock->size = p->size - (start - p->start); newblock->size = p->size - (start - p->start);
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
...@@ -96,7 +96,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size, ...@@ -96,7 +96,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out; goto out;
newblock->start = start + size; newblock->start = start + size;
newblock->size = p->size - size; newblock->size = p->size - size;
newblock->filp = 0; newblock->filp = NULL;
newblock->next = p->next; newblock->next = p->next;
newblock->prev = p; newblock->prev = p;
p->next->prev = newblock; p->next->prev = newblock;
...@@ -118,7 +118,7 @@ static struct mem_block *alloc_block(struct mem_block *heap, int size, ...@@ -118,7 +118,7 @@ static struct mem_block *alloc_block(struct mem_block *heap, int size,
for (p = heap->next; p != heap; p = p->next) { for (p = heap->next; p != heap; p = p->next) {
int start = (p->start + mask) & ~mask; int start = (p->start + mask) & ~mask;
if (p->filp == 0 && start + size <= p->start + p->size) if (p->filp == NULL && start + size <= p->start + p->size)
return split_block(p, start, size, filp); return split_block(p, start, size, filp);
} }
...@@ -138,12 +138,12 @@ static struct mem_block *find_block(struct mem_block *heap, int start) ...@@ -138,12 +138,12 @@ static struct mem_block *find_block(struct mem_block *heap, int start)
static void free_block(struct mem_block *p) static void free_block(struct mem_block *p)
{ {
p->filp = 0; p->filp = NULL;
/* Assumes a single contiguous range. Needs a special filp in /* Assumes a single contiguous range. Needs a special filp in
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
if (p->next->filp == 0) { if (p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;
...@@ -151,7 +151,7 @@ static void free_block(struct mem_block *p) ...@@ -151,7 +151,7 @@ static void free_block(struct mem_block *p)
DRM_FREE(q, sizeof(*q)); DRM_FREE(q, sizeof(*q));
} }
if (p->prev->filp == 0) { if (p->prev->filp == NULL) {
struct mem_block *q = p->prev; struct mem_block *q = p->prev;
q->size += p->size; q->size += p->size;
q->next = p->next; q->next = p->next;
...@@ -177,7 +177,7 @@ static int init_heap(struct mem_block **heap, int start, int size) ...@@ -177,7 +177,7 @@ static int init_heap(struct mem_block **heap, int start, int size)
blocks->start = start; blocks->start = start;
blocks->size = size; blocks->size = size;
blocks->filp = 0; blocks->filp = NULL;
blocks->next = blocks->prev = *heap; blocks->next = blocks->prev = *heap;
memset(*heap, 0, sizeof(**heap)); memset(*heap, 0, sizeof(**heap));
...@@ -197,7 +197,7 @@ void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap) ...@@ -197,7 +197,7 @@ void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap)
for (p = heap->next; p != heap; p = p->next) { for (p = heap->next; p != heap; p = p->next) {
if (p->filp == filp) { if (p->filp == filp) {
p->filp = 0; p->filp = NULL;
mark_block(dev, p, 0); mark_block(dev, p, 0);
} }
} }
...@@ -206,7 +206,7 @@ void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap) ...@@ -206,7 +206,7 @@ void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap)
* 'heap' to stop it being subsumed. * 'heap' to stop it being subsumed.
*/ */
for (p = heap->next; p != heap; p = p->next) { for (p = heap->next; p != heap; p = p->next) {
while (p->filp == 0 && p->next->filp == 0) { while (p->filp == NULL && p->next->filp == NULL) {
struct mem_block *q = p->next; struct mem_block *q = p->next;
p->size += q->size; p->size += q->size;
p->next = q->next; p->next = q->next;
......
...@@ -90,9 +90,10 @@ int sis_fb_alloc( DRM_IOCTL_ARGS ) ...@@ -90,9 +90,10 @@ int sis_fb_alloc( DRM_IOCTL_ARGS )
{ {
drm_sis_mem_t fb; drm_sis_mem_t fb;
struct sis_memreq req; struct sis_memreq req;
drm_sis_mem_t __user *argp = (void __user *)data;
int retval = 0; int retval = 0;
DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t *)data, sizeof(fb)); DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb));
req.size = fb.size; req.size = fb.size;
sis_malloc(&req); sis_malloc(&req);
...@@ -111,7 +112,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS ) ...@@ -111,7 +112,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS )
fb.free = 0; fb.free = 0;
} }
DRM_COPY_TO_USER_IOCTL((drm_sis_mem_t *)data, fb, sizeof(fb)); DRM_COPY_TO_USER_IOCTL(argp, fb, sizeof(fb));
DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, req.offset); DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, req.offset);
...@@ -123,7 +124,7 @@ int sis_fb_free( DRM_IOCTL_ARGS ) ...@@ -123,7 +124,7 @@ int sis_fb_free( DRM_IOCTL_ARGS )
drm_sis_mem_t fb; drm_sis_mem_t fb;
int retval = 0; int retval = 0;
DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t *)data, sizeof(fb)); DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *)data, sizeof(fb));
if (!fb.free) if (!fb.free)
return DRM_ERR(EINVAL); return DRM_ERR(EINVAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment