drm: Fix __user sparse warnings
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 19 Dec 2011 22:06:42 +0000 (00:06 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Dec 2011 10:03:21 +0000 (10:03 +0000)
Several pointers and casts were missing __user annotations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index 7cb02f63b8e36489dc5afe4611288d51580669eb..e05d997915445cab42e1fb2fe8e48fac0297587e 100644 (file)
@@ -1441,7 +1441,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
         */
        if ((out_resp->count_modes >= mode_count) && mode_count) {
                copied = 0;
-               mode_ptr = (struct drm_mode_modeinfo *)(unsigned long)out_resp->modes_ptr;
+               mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr;
                list_for_each_entry(mode, &connector->modes, head) {
                        drm_crtc_convert_to_umode(&u_mode, mode);
                        if (copy_to_user(mode_ptr + copied,
@@ -1456,8 +1456,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
 
        if ((out_resp->count_props >= props_count) && props_count) {
                copied = 0;
-               prop_ptr = (uint32_t *)(unsigned long)(out_resp->props_ptr);
-               prop_values = (uint64_t *)(unsigned long)(out_resp->prop_values_ptr);
+               prop_ptr = (uint32_t __user *)(unsigned long)(out_resp->props_ptr);
+               prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr);
                for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
                        if (connector->property_ids[i] != 0) {
                                if (put_user(connector->property_ids[i],
@@ -1479,7 +1479,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
 
        if ((out_resp->count_encoders >= encoders_count) && encoders_count) {
                copied = 0;
-               encoder_ptr = (uint32_t *)(unsigned long)(out_resp->encoders_ptr);
+               encoder_ptr = (uint32_t __user *)(unsigned long)(out_resp->encoders_ptr);
                for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
                        if (connector->encoder_ids[i] != 0) {
                                if (put_user(connector->encoder_ids[i],
@@ -1561,7 +1561,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
         */
        if (config->num_plane &&
            (plane_resp->count_planes >= config->num_plane)) {
-               plane_ptr = (uint32_t *)(unsigned long)plane_resp->plane_id_ptr;
+               plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr;
 
                list_for_each_entry(plane, &config->plane_list, head) {
                        if (put_user(plane->base.id, plane_ptr + copied)) {
@@ -1628,7 +1628,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
         */
        if (plane->format_count &&
            (plane_resp->count_format_types >= plane->format_count)) {
-               format_ptr = (uint32_t *)(unsigned long)plane_resp->format_type_ptr;
+               format_ptr = (uint32_t __user *)(unsigned long)plane_resp->format_type_ptr;
                if (copy_to_user(format_ptr,
                                 plane->format_types,
                                 sizeof(uint32_t) * plane->format_count)) {
@@ -1829,7 +1829,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
                }
 
                for (i = 0; i < crtc_req->count_connectors; i++) {
-                       set_connectors_ptr = (uint32_t *)(unsigned long)crtc_req->set_connectors_ptr;
+                       set_connectors_ptr = (uint32_t __user *)(unsigned long)crtc_req->set_connectors_ptr;
                        if (get_user(out_id, &set_connectors_ptr[i])) {
                                ret = -EFAULT;
                                goto out;
@@ -2201,7 +2201,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
        fb = obj_to_fb(obj);
 
        num_clips = r->num_clips;
-       clips_ptr = (struct drm_clip_rect *)(unsigned long)r->clips_ptr;
+       clips_ptr = (struct drm_clip_rect __user *)(unsigned long)r->clips_ptr;
 
        if (!num_clips != !clips_ptr) {
                ret = -EINVAL;
@@ -2591,7 +2591,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
        struct drm_property_enum *prop_enum;
        struct drm_mode_property_enum __user *enum_ptr;
        struct drm_property_blob *prop_blob;
-       uint32_t *blob_id_ptr;
+       uint32_t __user *blob_id_ptr;
        uint64_t __user *values_ptr;
        uint32_t __user *blob_length_ptr;
 
@@ -2621,7 +2621,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
        out_resp->flags = property->flags;
 
        if ((out_resp->count_values >= value_count) && value_count) {
-               values_ptr = (uint64_t *)(unsigned long)out_resp->values_ptr;
+               values_ptr = (uint64_t __user *)(unsigned long)out_resp->values_ptr;
                for (i = 0; i < value_count; i++) {
                        if (copy_to_user(values_ptr + i, &property->values[i], sizeof(uint64_t))) {
                                ret = -EFAULT;
@@ -2634,7 +2634,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
        if (property->flags & DRM_MODE_PROP_ENUM) {
                if ((out_resp->count_enum_blobs >= enum_count) && enum_count) {
                        copied = 0;
-                       enum_ptr = (struct drm_mode_property_enum *)(unsigned long)out_resp->enum_blob_ptr;
+                       enum_ptr = (struct drm_mode_property_enum __user *)(unsigned long)out_resp->enum_blob_ptr;
                        list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
 
                                if (copy_to_user(&enum_ptr[copied].value, &prop_enum->value, sizeof(uint64_t))) {
@@ -2656,8 +2656,8 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
        if (property->flags & DRM_MODE_PROP_BLOB) {
                if ((out_resp->count_enum_blobs >= blob_count) && blob_count) {
                        copied = 0;
-                       blob_id_ptr = (uint32_t *)(unsigned long)out_resp->enum_blob_ptr;
-                       blob_length_ptr = (uint32_t *)(unsigned long)out_resp->values_ptr;
+                       blob_id_ptr = (uint32_t __user *)(unsigned long)out_resp->enum_blob_ptr;
+                       blob_length_ptr = (uint32_t __user *)(unsigned long)out_resp->values_ptr;
 
                        list_for_each_entry(prop_blob, &property->enum_blob_list, head) {
                                if (put_user(prop_blob->base.id, blob_id_ptr + copied)) {
@@ -2718,7 +2718,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
        struct drm_mode_get_blob *out_resp = data;
        struct drm_property_blob *blob;
        int ret = 0;
-       void *blob_ptr;
+       void __user *blob_ptr;
 
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
@@ -2732,7 +2732,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
        blob = obj_to_blob(obj);
 
        if (out_resp->length == blob->length) {
-               blob_ptr = (void *)(unsigned long)out_resp->data;
+               blob_ptr = (void __user *)(unsigned long)out_resp->data;
                if (copy_to_user(blob_ptr, blob->data, blob->length)){
                        ret = -EFAULT;
                        goto done;