mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-07 12:18:05 +02:00
fix warnings
This commit is contained in:
parent
3a1e399a64
commit
b9c6426369
12 changed files with 60 additions and 46 deletions
|
|
@ -45,8 +45,12 @@
|
|||
*arg1 = arg2
|
||||
#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \
|
||||
arg1 = *arg2
|
||||
#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \
|
||||
copyout(arg2, arg1, arg3)
|
||||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copyin(arg2, arg1, arg3)
|
||||
|
||||
typedef u_int32_t atomic_t;
|
||||
typedef unsigned long atomic_t;
|
||||
typedef u_int32_t cycles_t;
|
||||
typedef u_int32_t spinlock_t;
|
||||
typedef u_int32_t u32;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,12 @@
|
|||
*arg1 = arg2
|
||||
#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \
|
||||
arg1 = *arg2
|
||||
#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \
|
||||
copyout(arg2, arg1, arg3)
|
||||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copyin(arg2, arg1, arg3)
|
||||
|
||||
typedef u_int32_t atomic_t;
|
||||
typedef unsigned long atomic_t;
|
||||
typedef u_int32_t cycles_t;
|
||||
typedef u_int32_t spinlock_t;
|
||||
typedef u_int32_t u32;
|
||||
|
|
|
|||
|
|
@ -852,16 +852,16 @@ int DRM(infobufs)( DRM_OS_IOCTL )
|
|||
drm_buf_desc_t *to = &request.list[count];
|
||||
drm_buf_entry_t *from = &dma->bufs[i];
|
||||
drm_freelist_t *list = &dma->bufs[i].freelist;
|
||||
if ( copy_to_user( &to->count,
|
||||
if ( DRM_OS_COPYTOUSR( &to->count,
|
||||
&from->buf_count,
|
||||
sizeof(from->buf_count) ) ||
|
||||
copy_to_user( &to->size,
|
||||
DRM_OS_COPYTOUSR( &to->size,
|
||||
&from->buf_size,
|
||||
sizeof(from->buf_size) ) ||
|
||||
copy_to_user( &to->low_mark,
|
||||
DRM_OS_COPYTOUSR( &to->low_mark,
|
||||
&list->low_mark,
|
||||
sizeof(list->low_mark) ) ||
|
||||
copy_to_user( &to->high_mark,
|
||||
DRM_OS_COPYTOUSR( &to->high_mark,
|
||||
&list->high_mark,
|
||||
sizeof(list->high_mark) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
@ -928,7 +928,7 @@ int DRM(freebufs)( DRM_OS_IOCTL )
|
|||
|
||||
DRM_DEBUG( "%d\n", request.count );
|
||||
for ( i = 0 ; i < request.count ; i++ ) {
|
||||
if ( copy_from_user( &idx,
|
||||
if ( DRM_OS_COPYFROMUSR( &idx,
|
||||
&request.list[i],
|
||||
sizeof(idx) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
@ -1029,29 +1029,29 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
|
|||
request.virtual = (void *)virtual;
|
||||
|
||||
for ( i = 0 ; i < dma->buf_count ; i++ ) {
|
||||
if ( copy_to_user( &request.list[i].idx,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].idx,
|
||||
&dma->buflist[i]->idx,
|
||||
sizeof(request.list[0].idx) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
if ( copy_to_user( &request.list[i].total,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].total,
|
||||
&dma->buflist[i]->total,
|
||||
sizeof(request.list[0].total) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
if ( copy_to_user( &request.list[i].used,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].used,
|
||||
&zero,
|
||||
sizeof(zero) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
address = virtual + dma->buflist[i]->offset; /* *** */
|
||||
if ( copy_to_user( &request.list[i].address,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].address,
|
||||
&address,
|
||||
sizeof(address) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
@ -1062,7 +1062,7 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
|
|||
|
||||
DRM_OS_KRNTOUSR( (drm_buf_map_t *)data, request, sizeof(request) );
|
||||
|
||||
return retcode;
|
||||
DRM_OS_RETURN(retcode);
|
||||
}
|
||||
|
||||
#endif /* __HAVE_DMA */
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
|
|||
memset( &ctx, 0, sizeof(ctx) );
|
||||
for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
|
||||
ctx.handle = i;
|
||||
if ( copy_to_user( &res.contexts[i],
|
||||
if ( DRM_OS_COPYTOUSR( &res.contexts[i],
|
||||
&i, sizeof(i) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
}
|
||||
|
|
@ -581,7 +581,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
|
|||
memset(&ctx, 0, sizeof(ctx));
|
||||
for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
|
||||
ctx.handle = i;
|
||||
if (copy_to_user(&res.contexts[i],
|
||||
if (DRM_OS_COPYTOUSR(&res.contexts[i],
|
||||
&i,
|
||||
sizeof(i)))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ int DRM(version)( DRM_OS_IOCTL )
|
|||
if ( len > name##_len ) len = name##_len; \
|
||||
name##_len = strlen( value ); \
|
||||
if ( len && name ) { \
|
||||
if ( copy_to_user( name, value, len ) ) \
|
||||
if ( DRM_OS_COPYTOUSR( name, value, len ) ) \
|
||||
DRM_OS_RETURN(EFAULT); \
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ int DRM(getunique)( DRM_OS_IOCTL )
|
|||
DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) );
|
||||
|
||||
if (u.unique_len >= dev->unique_len) {
|
||||
if (copy_to_user(u.unique, dev->unique, dev->unique_len))
|
||||
if (DRM_OS_COPYTOUSR(u.unique, dev->unique, dev->unique_len))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
}
|
||||
u.unique_len = dev->unique_len;
|
||||
|
|
@ -123,7 +123,7 @@ int DRM(setunique)( DRM_OS_IOCTL )
|
|||
|
||||
dev->unique_len = u.unique_len;
|
||||
dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER);
|
||||
if (copy_from_user(dev->unique, u.unique, dev->unique_len))
|
||||
if (DRM_OS_COPYFROMUSR(dev->unique, u.unique, dev->unique_len))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
dev->unique[dev->unique_len] = '\0';
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ int DRM(getmap)( DRM_OS_IOCTL )
|
|||
drm_map_list_entry_t *list;
|
||||
#endif
|
||||
int idx;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
DRM_OS_KRNFROMUSR( map, (drm_map_t *)data, sizeof(map) );
|
||||
|
||||
|
|
@ -181,7 +181,6 @@ int DRM(getmap)( DRM_OS_IOCTL )
|
|||
DRM_OS_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
#ifdef __linux__
|
||||
list_for_each(list, &dev->maplist->head) {
|
||||
if(i == idx) {
|
||||
|
|
@ -236,7 +235,7 @@ int DRM(getclient)( DRM_OS_IOCTL )
|
|||
drm_client_t client;
|
||||
drm_file_t *pt;
|
||||
int idx;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
DRM_OS_KRNFROMUSR( client, (drm_client_t *)data, sizeof(client) );
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,10 @@ do { \
|
|||
#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \
|
||||
if ( copy_from_user(&arg1, arg2, arg3) ) \
|
||||
return -EFAULT
|
||||
#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \
|
||||
copy_to_user(arg1, arg2, arg3)
|
||||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copy_from_user(arg1, arg2, arg3)
|
||||
|
||||
/* Internal functions */
|
||||
|
||||
|
|
|
|||
|
|
@ -852,16 +852,16 @@ int DRM(infobufs)( DRM_OS_IOCTL )
|
|||
drm_buf_desc_t *to = &request.list[count];
|
||||
drm_buf_entry_t *from = &dma->bufs[i];
|
||||
drm_freelist_t *list = &dma->bufs[i].freelist;
|
||||
if ( copy_to_user( &to->count,
|
||||
if ( DRM_OS_COPYTOUSR( &to->count,
|
||||
&from->buf_count,
|
||||
sizeof(from->buf_count) ) ||
|
||||
copy_to_user( &to->size,
|
||||
DRM_OS_COPYTOUSR( &to->size,
|
||||
&from->buf_size,
|
||||
sizeof(from->buf_size) ) ||
|
||||
copy_to_user( &to->low_mark,
|
||||
DRM_OS_COPYTOUSR( &to->low_mark,
|
||||
&list->low_mark,
|
||||
sizeof(list->low_mark) ) ||
|
||||
copy_to_user( &to->high_mark,
|
||||
DRM_OS_COPYTOUSR( &to->high_mark,
|
||||
&list->high_mark,
|
||||
sizeof(list->high_mark) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
@ -928,7 +928,7 @@ int DRM(freebufs)( DRM_OS_IOCTL )
|
|||
|
||||
DRM_DEBUG( "%d\n", request.count );
|
||||
for ( i = 0 ; i < request.count ; i++ ) {
|
||||
if ( copy_from_user( &idx,
|
||||
if ( DRM_OS_COPYFROMUSR( &idx,
|
||||
&request.list[i],
|
||||
sizeof(idx) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
@ -1029,29 +1029,29 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
|
|||
request.virtual = (void *)virtual;
|
||||
|
||||
for ( i = 0 ; i < dma->buf_count ; i++ ) {
|
||||
if ( copy_to_user( &request.list[i].idx,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].idx,
|
||||
&dma->buflist[i]->idx,
|
||||
sizeof(request.list[0].idx) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
if ( copy_to_user( &request.list[i].total,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].total,
|
||||
&dma->buflist[i]->total,
|
||||
sizeof(request.list[0].total) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
if ( copy_to_user( &request.list[i].used,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].used,
|
||||
&zero,
|
||||
sizeof(zero) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
address = virtual + dma->buflist[i]->offset; /* *** */
|
||||
if ( copy_to_user( &request.list[i].address,
|
||||
if ( DRM_OS_COPYTOUSR( &request.list[i].address,
|
||||
&address,
|
||||
sizeof(address) ) ) {
|
||||
retcode = -EFAULT;
|
||||
retcode = EFAULT;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
|
@ -1062,7 +1062,7 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
|
|||
|
||||
DRM_OS_KRNTOUSR( (drm_buf_map_t *)data, request, sizeof(request) );
|
||||
|
||||
return retcode;
|
||||
DRM_OS_RETURN(retcode);
|
||||
}
|
||||
|
||||
#endif /* __HAVE_DMA */
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
|
|||
memset( &ctx, 0, sizeof(ctx) );
|
||||
for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
|
||||
ctx.handle = i;
|
||||
if ( copy_to_user( &res.contexts[i],
|
||||
if ( DRM_OS_COPYTOUSR( &res.contexts[i],
|
||||
&i, sizeof(i) ) )
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
}
|
||||
|
|
@ -581,7 +581,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
|
|||
memset(&ctx, 0, sizeof(ctx));
|
||||
for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
|
||||
ctx.handle = i;
|
||||
if (copy_to_user(&res.contexts[i],
|
||||
if (DRM_OS_COPYTOUSR(&res.contexts[i],
|
||||
&i,
|
||||
sizeof(i)))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ int DRM(version)( DRM_OS_IOCTL )
|
|||
if ( len > name##_len ) len = name##_len; \
|
||||
name##_len = strlen( value ); \
|
||||
if ( len && name ) { \
|
||||
if ( copy_to_user( name, value, len ) ) \
|
||||
if ( DRM_OS_COPYTOUSR( name, value, len ) ) \
|
||||
DRM_OS_RETURN(EFAULT); \
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ int DRM(getunique)( DRM_OS_IOCTL )
|
|||
DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) );
|
||||
|
||||
if (u.unique_len >= dev->unique_len) {
|
||||
if (copy_to_user(u.unique, dev->unique, dev->unique_len))
|
||||
if (DRM_OS_COPYTOUSR(u.unique, dev->unique, dev->unique_len))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
}
|
||||
u.unique_len = dev->unique_len;
|
||||
|
|
@ -123,7 +123,7 @@ int DRM(setunique)( DRM_OS_IOCTL )
|
|||
|
||||
dev->unique_len = u.unique_len;
|
||||
dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER);
|
||||
if (copy_from_user(dev->unique, u.unique, dev->unique_len))
|
||||
if (DRM_OS_COPYFROMUSR(dev->unique, u.unique, dev->unique_len))
|
||||
DRM_OS_RETURN(EFAULT);
|
||||
dev->unique[dev->unique_len] = '\0';
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ int DRM(getmap)( DRM_OS_IOCTL )
|
|||
drm_map_list_entry_t *list;
|
||||
#endif
|
||||
int idx;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
DRM_OS_KRNFROMUSR( map, (drm_map_t *)data, sizeof(map) );
|
||||
|
||||
|
|
@ -181,7 +181,6 @@ int DRM(getmap)( DRM_OS_IOCTL )
|
|||
DRM_OS_RETURN(EINVAL);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
#ifdef __linux__
|
||||
list_for_each(list, &dev->maplist->head) {
|
||||
if(i == idx) {
|
||||
|
|
@ -236,7 +235,7 @@ int DRM(getclient)( DRM_OS_IOCTL )
|
|||
drm_client_t client;
|
||||
drm_file_t *pt;
|
||||
int idx;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
DRM_OS_KRNFROMUSR( client, (drm_client_t *)data, sizeof(client) );
|
||||
|
||||
|
|
|
|||
|
|
@ -272,6 +272,10 @@ do { \
|
|||
#define DRM_OS_KRNFROMUSR(arg1, arg2, arg3) \
|
||||
if ( copy_from_user(&arg1, arg2, arg3) ) \
|
||||
return -EFAULT
|
||||
#define DRM_OS_COPYTOUSR(arg1, arg2, arg3) \
|
||||
copy_to_user(arg1, arg2, arg3)
|
||||
#define DRM_OS_COPYFROMUSR(arg1, arg2, arg3) \
|
||||
copy_from_user(arg1, arg2, arg3)
|
||||
|
||||
/* Internal functions */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue