Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
91e9b021
K
Kernel
项目概览
openeuler
/
Kernel
2 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
91e9b021
编写于
12月 13, 2022
作者:
J
Jiri Kosina
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-6.2/hyperv' into for-linus
- functionally equivalent code cleanups for hyperv driver (Paulo Miguel Almeida)
上级
8d437f11
6a462899
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
21 deletion
+10
-21
drivers/hid/hid-hyperv.c
drivers/hid/hid-hyperv.c
+10
-21
未找到文件。
drivers/hid/hid-hyperv.c
浏览文件 @
91e9b021
...
@@ -22,9 +22,6 @@ struct hv_input_dev_info {
...
@@ -22,9 +22,6 @@ struct hv_input_dev_info {
unsigned
short
reserved
[
11
];
unsigned
short
reserved
[
11
];
};
};
/* The maximum size of a synthetic input message. */
#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16
/*
/*
* Current version
* Current version
*
*
...
@@ -59,11 +56,6 @@ struct synthhid_msg_hdr {
...
@@ -59,11 +56,6 @@ struct synthhid_msg_hdr {
u32
size
;
u32
size
;
};
};
struct
synthhid_msg
{
struct
synthhid_msg_hdr
header
;
char
data
[
1
];
/* Enclosed message */
};
union
synthhid_version
{
union
synthhid_version
{
struct
{
struct
{
u16
minor_version
;
u16
minor_version
;
...
@@ -99,7 +91,7 @@ struct synthhid_device_info_ack {
...
@@ -99,7 +91,7 @@ struct synthhid_device_info_ack {
struct
synthhid_input_report
{
struct
synthhid_input_report
{
struct
synthhid_msg_hdr
header
;
struct
synthhid_msg_hdr
header
;
char
buffer
[
1
];
char
buffer
[];
};
};
#pragma pack(pop)
#pragma pack(pop)
...
@@ -118,7 +110,7 @@ enum pipe_prot_msg_type {
...
@@ -118,7 +110,7 @@ enum pipe_prot_msg_type {
struct
pipe_prt_msg
{
struct
pipe_prt_msg
{
enum
pipe_prot_msg_type
type
;
enum
pipe_prot_msg_type
type
;
u32
size
;
u32
size
;
char
data
[
1
];
char
data
[];
};
};
struct
mousevsc_prt_msg
{
struct
mousevsc_prt_msg
{
...
@@ -232,7 +224,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
...
@@ -232,7 +224,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
ret
=
vmbus_sendpacket
(
input_device
->
device
->
channel
,
ret
=
vmbus_sendpacket
(
input_device
->
device
->
channel
,
&
ack
,
&
ack
,
sizeof
(
struct
pipe_prt_msg
)
-
sizeof
(
unsigned
char
)
+
sizeof
(
struct
pipe_prt_msg
)
+
sizeof
(
struct
synthhid_device_info_ack
),
sizeof
(
struct
synthhid_device_info_ack
),
(
unsigned
long
)
&
ack
,
(
unsigned
long
)
&
ack
,
VM_PKT_DATA_INBAND
,
VM_PKT_DATA_INBAND
,
...
@@ -251,7 +243,7 @@ static void mousevsc_on_receive(struct hv_device *device,
...
@@ -251,7 +243,7 @@ static void mousevsc_on_receive(struct hv_device *device,
struct
vmpacket_descriptor
*
packet
)
struct
vmpacket_descriptor
*
packet
)
{
{
struct
pipe_prt_msg
*
pipe_msg
;
struct
pipe_prt_msg
*
pipe_msg
;
struct
synthhid_msg
*
hid_msg
;
struct
synthhid_msg
_hdr
*
hid_msg_hdr
;
struct
mousevsc_dev
*
input_dev
=
hv_get_drvdata
(
device
);
struct
mousevsc_dev
*
input_dev
=
hv_get_drvdata
(
device
);
struct
synthhid_input_report
*
input_report
;
struct
synthhid_input_report
*
input_report
;
size_t
len
;
size_t
len
;
...
@@ -262,25 +254,23 @@ static void mousevsc_on_receive(struct hv_device *device,
...
@@ -262,25 +254,23 @@ static void mousevsc_on_receive(struct hv_device *device,
if
(
pipe_msg
->
type
!=
PIPE_MESSAGE_DATA
)
if
(
pipe_msg
->
type
!=
PIPE_MESSAGE_DATA
)
return
;
return
;
hid_msg
=
(
struct
synthhid_msg
*
)
pipe_msg
->
data
;
hid_msg
_hdr
=
(
struct
synthhid_msg_hdr
*
)
pipe_msg
->
data
;
switch
(
hid_msg
->
header
.
type
)
{
switch
(
hid_msg
_hdr
->
type
)
{
case
SYNTH_HID_PROTOCOL_RESPONSE
:
case
SYNTH_HID_PROTOCOL_RESPONSE
:
/*
/*
* While it will be impossible for us to protect against
* While it will be impossible for us to protect against
* malicious/buggy hypervisor/host, add a check here to
* malicious/buggy hypervisor/host, add a check here to
* ensure we don't corrupt memory.
* ensure we don't corrupt memory.
*/
*/
if
((
pipe_msg
->
size
+
sizeof
(
struct
pipe_prt_msg
)
if
(
struct_size
(
pipe_msg
,
data
,
pipe_msg
->
size
)
-
sizeof
(
unsigned
char
))
>
sizeof
(
struct
mousevsc_prt_msg
))
{
>
sizeof
(
struct
mousevsc_prt_msg
))
{
WARN_ON
(
1
);
WARN_ON
(
1
);
break
;
break
;
}
}
memcpy
(
&
input_dev
->
protocol_resp
,
pipe_msg
,
memcpy
(
&
input_dev
->
protocol_resp
,
pipe_msg
,
pipe_msg
->
size
+
sizeof
(
struct
pipe_prt_msg
)
-
struct_size
(
pipe_msg
,
data
,
pipe_msg
->
size
));
sizeof
(
unsigned
char
));
complete
(
&
input_dev
->
wait_event
);
complete
(
&
input_dev
->
wait_event
);
break
;
break
;
...
@@ -311,7 +301,7 @@ static void mousevsc_on_receive(struct hv_device *device,
...
@@ -311,7 +301,7 @@ static void mousevsc_on_receive(struct hv_device *device,
break
;
break
;
default:
default:
pr_err
(
"unsupported hid msg type - type %d len %d
\n
"
,
pr_err
(
"unsupported hid msg type - type %d len %d
\n
"
,
hid_msg
->
header
.
type
,
hid_msg
->
header
.
size
);
hid_msg
_hdr
->
type
,
hid_msg_hdr
->
size
);
break
;
break
;
}
}
...
@@ -359,8 +349,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
...
@@ -359,8 +349,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
request
->
request
.
version_requested
.
version
=
SYNTHHID_INPUT_VERSION
;
request
->
request
.
version_requested
.
version
=
SYNTHHID_INPUT_VERSION
;
ret
=
vmbus_sendpacket
(
device
->
channel
,
request
,
ret
=
vmbus_sendpacket
(
device
->
channel
,
request
,
sizeof
(
struct
pipe_prt_msg
)
-
sizeof
(
struct
pipe_prt_msg
)
+
sizeof
(
unsigned
char
)
+
sizeof
(
struct
synthhid_protocol_request
),
sizeof
(
struct
synthhid_protocol_request
),
(
unsigned
long
)
request
,
(
unsigned
long
)
request
,
VM_PKT_DATA_INBAND
,
VM_PKT_DATA_INBAND
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录