drm/i915: Use expcitly fixed type in compat32 structs
I was confused shortly whether the compat was needed for the int, until I noticed the pointer in the original. Also remove typedef. v2: Review from Chris. - Add comments. - Also change the int param in the original structure. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
1f7457b135
commit
346add7834
2 changed files with 14 additions and 5 deletions
|
@ -35,15 +35,20 @@
|
||||||
#include <drm/i915_drm.h>
|
#include <drm/i915_drm.h>
|
||||||
#include "i915_drv.h"
|
#include "i915_drv.h"
|
||||||
|
|
||||||
typedef struct drm_i915_getparam32 {
|
struct drm_i915_getparam32 {
|
||||||
int param;
|
s32 param;
|
||||||
|
/*
|
||||||
|
* We screwed up the generic ioctl struct here and used a variable-sized
|
||||||
|
* pointer. Use u32 in the compat struct to match the 32bit pointer
|
||||||
|
* userspace expects.
|
||||||
|
*/
|
||||||
u32 value;
|
u32 value;
|
||||||
} drm_i915_getparam32_t;
|
};
|
||||||
|
|
||||||
static int compat_i915_getparam(struct file *file, unsigned int cmd,
|
static int compat_i915_getparam(struct file *file, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
drm_i915_getparam32_t req32;
|
struct drm_i915_getparam32 req32;
|
||||||
drm_i915_getparam_t __user *request;
|
drm_i915_getparam_t __user *request;
|
||||||
|
|
||||||
if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
|
if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
|
||||||
|
|
|
@ -358,7 +358,11 @@ typedef struct drm_i915_irq_wait {
|
||||||
#define I915_PARAM_HAS_RESOURCE_STREAMER 36
|
#define I915_PARAM_HAS_RESOURCE_STREAMER 36
|
||||||
|
|
||||||
typedef struct drm_i915_getparam {
|
typedef struct drm_i915_getparam {
|
||||||
int param;
|
s32 param;
|
||||||
|
/*
|
||||||
|
* WARNING: Using pointers instead of fixed-size u64 means we need to write
|
||||||
|
* compat32 code. Don't repeat this mistake.
|
||||||
|
*/
|
||||||
int __user *value;
|
int __user *value;
|
||||||
} drm_i915_getparam_t;
|
} drm_i915_getparam_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue