mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 14:48:06 +00:00
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>
This commit is contained in:
parent
24f910365e
commit
e5581fe2b4
1 changed files with 11 additions and 5 deletions
|
@ -98,17 +98,23 @@ success:
|
||||||
static int udl_select_std_channel(struct udl_device *udl)
|
static int udl_select_std_channel(struct udl_device *udl)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7,
|
static const u8 set_def_chn[] = {0x57, 0xCD, 0xDC, 0xA7,
|
||||||
0x1C, 0x88, 0x5E, 0x15,
|
0x1C, 0x88, 0x5E, 0x15,
|
||||||
0x60, 0xFE, 0xC6, 0x97,
|
0x60, 0xFE, 0xC6, 0x97,
|
||||||
0x16, 0x3D, 0x47, 0xF2};
|
0x16, 0x3D, 0x47, 0xF2};
|
||||||
|
void *sendbuf;
|
||||||
|
|
||||||
|
sendbuf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL);
|
||||||
|
if (!sendbuf)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = usb_control_msg(udl->udev,
|
ret = usb_control_msg(udl->udev,
|
||||||
usb_sndctrlpipe(udl->udev, 0),
|
usb_sndctrlpipe(udl->udev, 0),
|
||||||
NR_USB_REQUEST_CHANNEL,
|
NR_USB_REQUEST_CHANNEL,
|
||||||
(USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
|
(USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
|
||||||
set_def_chn, sizeof(set_def_chn),
|
sendbuf, sizeof(set_def_chn),
|
||||||
USB_CTRL_SET_TIMEOUT);
|
USB_CTRL_SET_TIMEOUT);
|
||||||
|
kfree(sendbuf);
|
||||||
return ret < 0 ? ret : 0;
|
return ret < 0 ? ret : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue