drm/qxl: sparse fixes.
Subsystems (3)
Gerd Hoffmann
maintainercover drm/qxl: sparse fixes.
Fix qxl __user annotations in uapi include. Also some more sparse easy warnings.
Some iomem address space issues left for another day.
Gerd Hoffmann (3):
drm/qxl: fix __user annotations
drm/qxl: declare a bunch of functions as static drm/qxl: move extern variable declaration header file
drivers/gpu/drm/qxl/qxl_drv.h | 1 + include/uapi/drm/qxl_drm.h | 6 +++--- drivers/gpu/drm/qxl/qxl_display.c | 18 +++++++++--------- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_ioctl.c | 17 +++++++++-------- drivers/gpu/drm/qxl/qxl_object.c | 4 ++-- 6 files changed, 24 insertions(+), 23 deletions(-)
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH 1/3 drm/qxl: fix __user annotations
Drop them from u64 fields, tag local variables correctly instead. While being at it switch the code to use u64_to_user_ptr().
--- include/uapi/drm/qxl_drm.h | 6 +++--- drivers/gpu/drm/qxl/qxl_ioctl.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-)
include/uapi/drm/qxl_drm.h +3 -3
@@ -80,8 +80,8 @@ struct drm_qxl_reloc { };struct drm_qxl_command { -__u64 __user command;/* void* */ -__u64 __user relocs;/* struct drm_qxl_reloc* */ +__u64 command;/* void* */ +__u64 relocs;/* struct drm_qxl_reloc* */ __u32 type;__u32 command_size;__u32 relocs_num;
@@ -91,7 +91,7 @@ struct drm_qxl_command {struct drm_qxl_execbuffer {__u32 flags;/* for future use */ __u32 commands_num; -__u64 __user commands;/* struct drm_qxl_command* */ +__u64 commands;/* struct drm_qxl_command* */ };struct drm_qxl_update_area {
drivers/gpu/drm/qxl/qxl_ioctl.c +9 -8
@@ -163,7 +163,7 @@ static int qxl_process_single_command(struct qxl_device *qdev,return -EINVAL ;if (!access_ok (VERIFY_READ , - (void *)(unsigned long )cmd->command, +u64_to_user_ptr (cmd->command), cmd->command_size))return -EFAULT ;
@@ -183,7 +183,9 @@ static int qxl_process_single_command(struct qxl_device *qdev,/* TODO copy slow path code from i915 */ fb_cmd =qxl_bo_kmap_atomic_page (qdev, cmd_bo, (release->release_offset &PAGE_SIZE )); - unwritten =__copy_from_user_inatomic_nocache (fb_cmd +sizeof (union qxl_release_info ) + (release->release_offset & ~PAGE_SIZE ), (void *)(unsigned long )cmd->command, cmd->command_size); + unwritten =__copy_from_user_inatomic_nocache + (fb_cmd +sizeof (union qxl_release_info ) + (release->release_offset & ~PAGE_SIZE ), +u64_to_user_ptr (cmd->command), cmd->command_size); {struct qxl_drawable *draw = fb_cmd;
@@ -201,10 +203,9 @@ static int qxl_process_single_command(struct qxl_device *qdev, num_relocs =0 ;for (i =0 ; i < cmd->relocs_num; ++i) {struct drm_qxl_reloc reloc; +struct drm_qxl_reloc __user *u =u64_to_user_ptr (cmd->relocs); -if (copy_from_user (&reloc, - &((struct drm_qxl_reloc *)(uintptr_t )cmd->relocs)[i], -sizeof (reloc))) { +if (copy_from_user (&reloc, u + i,sizeof (reloc))) { ret = -EFAULT ; goto out_free_bos; }
@@ -282,10 +283,10 @@ static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data,for (cmd_num =0 ; cmd_num < execbuffer->commands_num; ++cmd_num) { -struct drm_qxl_command *commands = - (struct drm_qxl_command *)(uintptr_t )execbuffer->commands; +struct drm_qxl_command __user *commands = +u64_to_user_ptr (execbuffer->commands); -if (copy_from_user (&user_cmd, &commands[cmd_num], +if (copy_from_user (&user_cmd, commands + cmd_num,sizeof (user_cmd)))return -EFAULT ;
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH 2/3 drm/qxl: declare a bunch of functions as static
In reply to Gerd HoffmannFlagged by sparse.
--- drivers/gpu/drm/qxl/qxl_display.c | 18 +++++++++--------- drivers/gpu/drm/qxl/qxl_object.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +9 -9
@@ -437,7 +437,7 @@ static void qxl_monitors_config_set(struct qxl_device *qdev, } -void qxl_mode_set_nofb (struct drm_crtc *crtc) +static void qxl_mode_set_nofb (struct drm_crtc *crtc) {struct qxl_device *qdev = crtc->dev->dev_private;struct qxl_crtc *qcrtc =to_qxl_crtc (crtc);
@@ -475,8 +475,8 @@ static const struct drm_crtc_helper_funcs qxl_crtc_helper_funcs = { .atomic_flush = qxl_crtc_atomic_flush, }; -int qxl_primary_atomic_check (struct drm_plane *plane, -struct drm_plane_state *state) +static int qxl_primary_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) {struct qxl_device *qdev = plane->dev->dev_private;struct qxl_framebuffer *qfb;
@@ -547,8 +547,8 @@ static void qxl_primary_atomic_disable(struct drm_plane *plane, } } -int qxl_plane_atomic_check (struct drm_plane *plane, -struct drm_plane_state *state) +static int qxl_plane_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) {return 0 ; }
@@ -647,8 +647,8 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, } -void qxl_cursor_atomic_disable (struct drm_plane *plane, -struct drm_plane_state *old_state) +static void qxl_cursor_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) {struct qxl_device *qdev = plane->dev->dev_private;struct qxl_release *release;
@@ -675,8 +675,8 @@ void qxl_cursor_atomic_disable(struct drm_plane *plane,qxl_release_fence_buffer_objects (release); } -int qxl_plane_prepare_fb (struct drm_plane *plane, -struct drm_plane_state *new_state) +static int qxl_plane_prepare_fb (struct drm_plane *plane, +struct drm_plane_state *new_state) {struct drm_gem_object *obj;struct qxl_bo *user_bo;
drivers/gpu/drm/qxl/qxl_object.c +2 -2
@@ -221,7 +221,7 @@ struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo)return bo; } -int __qxl_bo_pin (struct qxl_bo *bo,u32 domain,u64 *gpu_addr) +static int __qxl_bo_pin (struct qxl_bo *bo,u32 domain,u64 *gpu_addr) {struct drm_device *ddev = bo->gem_base.dev;int r;
@@ -244,7 +244,7 @@ int __qxl_bo_pin(struct qxl_bo *bo, u32 domain, u64 *gpu_addr)return r; } -int __qxl_bo_unpin (struct qxl_bo *bo) +static int __qxl_bo_unpin (struct qxl_bo *bo) {struct drm_device *ddev = bo->gem_base.dev;int r, i;
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH 3/3 drm/qxl: move extern variable declaration header file
In reply to Gerd HoffmannFlagged by sparse.
--- drivers/gpu/drm/qxl/qxl_drv.h | 1 + drivers/gpu/drm/qxl/qxl_drv.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_drv.h +1 -0
@@ -64,6 +64,7 @@extern int qxl_log_level;extern int qxl_num_crtc; +extern int qxl_max_ioctls;enum {QXL_INFO_LEVEL =1 ,
drivers/gpu/drm/qxl/qxl_drv.c +0 -1
@@ -37,7 +37,6 @@#include "qxl_drv.h" #include "qxl_object.h" -extern int qxl_max_ioctls;static const struct pci_device_id pciidlist[] = { {0x1b36 ,0x100 ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,0xffff00 ,0 },
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Gerd Hoffmann
Fix qxl
__userannotations in uapi include. Also some more sparse easy warnings.
Some iomem address space issues left for another day.Gerd Hoffmann (3):
drm/qxl: fix__userannotations
drm/qxl: declare a bunch of functions as static drm/qxl: move extern variable declaration header file
on the series: Acked-by: Daniel Vetter <[email protected]>
Quoted 16 lines
drivers/gpu/drm/qxl/qxl_drv.h | 1 + include/uapi/drm/qxl_drm.h | 6 +++--- drivers/gpu/drm/qxl/qxl_display.c | 18 +++++++++--------- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_ioctl.c | 17 +++++++++-------- drivers/gpu/drm/qxl/qxl_object.c | 4 ++-- 6 files changed, 24 insertions(+), 23 deletions(-)Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel