diff options
author | Dave Airlie <airlied@redhat.com> | 2016-11-08 01:38:00 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-11-10 17:57:34 -0500 |
commit | e5581fe2b4f40e54bfea9a1eee1bc487da52e98c (patch) | |
tree | 565d8b0dd5f3657b2856896707c69ddf2c3485bb /drivers/gpu/drm/udl/udl_main.c | |
parent | 24f910365e84342365a46e5c07d3ac02757c94a1 (diff) |
drm/udl: make control msg static const. (v2)
Thou shall not send control msg from the stack,
does that mean I can send it from the RO memory area?
and it looks like the answer is no, so here's
v2 which kmemdups.
Reported-by: poma
Tested-by: poma <poma@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/udl/udl_main.c')
-rw-r--r-- | drivers/gpu/drm/udl/udl_main.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 29f0207fa677..873f010d9616 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c | |||
@@ -98,17 +98,23 @@ success: | |||
98 | static int udl_select_std_channel(struct udl_device *udl) | 98 | static int udl_select_std_channel(struct udl_device *udl) |
99 | { | 99 | { |
100 | int ret; | 100 | int ret; |
101 | u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7, | 101 | static const u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7, |
102 | 0x1C, 0x88, 0x5E, 0x15, | 102 | 0x1C, 0x88, 0x5E, 0x15, |
103 | 0x60, 0xFE, 0xC6, 0x97, | 103 | 0x60, 0xFE, 0xC6, 0x97, |
104 | 0x16, 0x3D, 0x47, 0xF2}; | 104 | 0x16, 0x3D, 0x47, 0xF2}; |
105 | void *sendbuf; | ||
106 | |||
107 | sendbuf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL); | ||
108 | if (!sendbuf) | ||
109 | return -ENOMEM; | ||
105 | 110 | ||
106 | ret = usb_control_msg(udl->udev, | 111 | ret = usb_control_msg(udl->udev, |
107 | usb_sndctrlpipe(udl->udev, 0), | 112 | usb_sndctrlpipe(udl->udev, 0), |
108 | NR_USB_REQUEST_CHANNEL, | 113 | NR_USB_REQUEST_CHANNEL, |
109 | (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, | 114 | (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, |
110 | set_def_chn, sizeof(set_def_chn), | 115 | sendbuf, sizeof(set_def_chn), |
111 | USB_CTRL_SET_TIMEOUT); | 116 | USB_CTRL_SET_TIMEOUT); |
117 | kfree(sendbuf); | ||
112 | return ret < 0 ? ret : 0; | 118 | return ret < 0 ? ret : 0; |
113 | } | 119 | } |
114 | 120 | ||