Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
e5f699d4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e5f699d4
编写于
6月 26, 2017
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipmi: get rid of field-by-field __get_user()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
8b9e04f2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
50 deletion
+37
-50
drivers/char/ipmi/ipmi_devintf.c
drivers/char/ipmi/ipmi_devintf.c
+37
-50
未找到文件。
drivers/char/ipmi/ipmi_devintf.c
浏览文件 @
e5f699d4
...
...
@@ -704,62 +704,41 @@ struct compat_ipmi_req_settime {
/*
* Define some helper functions for copying IPMI data
*/
static
long
get_compat_ipmi_msg
(
struct
ipmi_msg
*
p64
,
struct
compat_ipmi_msg
__user
*
p32
)
static
void
get_compat_ipmi_msg
(
struct
ipmi_msg
*
p64
,
struct
compat_ipmi_msg
*
p32
)
{
compat_uptr_t
tmp
;
if
(
!
access_ok
(
VERIFY_READ
,
p32
,
sizeof
(
*
p32
))
||
__get_user
(
p64
->
netfn
,
&
p32
->
netfn
)
||
__get_user
(
p64
->
cmd
,
&
p32
->
cmd
)
||
__get_user
(
p64
->
data_len
,
&
p32
->
data_len
)
||
__get_user
(
tmp
,
&
p32
->
data
))
return
-
EFAULT
;
p64
->
data
=
compat_ptr
(
tmp
);
return
0
;
p64
->
netfn
=
p32
->
netfn
;
p64
->
cmd
=
p32
->
cmd
;
p64
->
data_len
=
p32
->
data_len
;
p64
->
data
=
compat_ptr
(
p32
->
data
);
}
static
long
get_compat_ipmi_req
(
struct
ipmi_req
*
p64
,
struct
compat_ipmi_req
__user
*
p32
)
static
void
get_compat_ipmi_req
(
struct
ipmi_req
*
p64
,
struct
compat_ipmi_req
*
p32
)
{
compat_uptr_t
tmp
;
if
(
!
access_ok
(
VERIFY_READ
,
p32
,
sizeof
(
*
p32
))
||
__get_user
(
tmp
,
&
p32
->
addr
)
||
__get_user
(
p64
->
addr_len
,
&
p32
->
addr_len
)
||
__get_user
(
p64
->
msgid
,
&
p32
->
msgid
)
||
get_compat_ipmi_msg
(
&
p64
->
msg
,
&
p32
->
msg
))
return
-
EFAULT
;
p64
->
addr
=
compat_ptr
(
tmp
);
return
0
;
p64
->
addr
=
compat_ptr
(
p32
->
addr
);
p64
->
addr_len
=
p32
->
addr_len
;
p64
->
msgid
=
p32
->
msgid
;
get_compat_ipmi_msg
(
&
p64
->
msg
,
&
p32
->
msg
);
}
static
long
get_compat_ipmi_req_settime
(
struct
ipmi_req_settime
*
p64
,
struct
compat_ipmi_req_settime
__user
*
p32
)
static
void
get_compat_ipmi_req_settime
(
struct
ipmi_req_settime
*
p64
,
struct
compat_ipmi_req_settime
*
p32
)
{
if
(
!
access_ok
(
VERIFY_READ
,
p32
,
sizeof
(
*
p32
))
||
get_compat_ipmi_req
(
&
p64
->
req
,
&
p32
->
req
)
||
__get_user
(
p64
->
retries
,
&
p32
->
retries
)
||
__get_user
(
p64
->
retry_time_ms
,
&
p32
->
retry_time_ms
))
return
-
EFAULT
;
return
0
;
get_compat_ipmi_req
(
&
p64
->
req
,
&
p32
->
req
);
p64
->
retries
=
p32
->
retries
;
p64
->
retry_time_ms
=
p32
->
retry_time_ms
;
}
static
long
get_compat_ipmi_recv
(
struct
ipmi_recv
*
p64
,
struct
compat_ipmi_recv
__user
*
p32
)
static
void
get_compat_ipmi_recv
(
struct
ipmi_recv
*
p64
,
struct
compat_ipmi_recv
*
p32
)
{
compat_uptr_t
tmp
;
if
(
!
access_ok
(
VERIFY_READ
,
p32
,
sizeof
(
*
p32
))
||
__get_user
(
p64
->
recv_type
,
&
p32
->
recv_type
)
||
__get_user
(
tmp
,
&
p32
->
addr
)
||
__get_user
(
p64
->
addr_len
,
&
p32
->
addr_len
)
||
__get_user
(
p64
->
msgid
,
&
p32
->
msgid
)
||
get_compat_ipmi_msg
(
&
p64
->
msg
,
&
p32
->
msg
))
return
-
EFAULT
;
p64
->
addr
=
compat_ptr
(
tmp
);
return
0
;
memset
(
p64
,
0
,
sizeof
(
struct
ipmi_recv
));
p64
->
recv_type
=
p32
->
recv_type
;
p64
->
addr
=
compat_ptr
(
p32
->
addr
);
p64
->
addr_len
=
p32
->
addr_len
;
p64
->
msgid
=
p32
->
msgid
;
get_compat_ipmi_msg
(
&
p64
->
msg
,
&
p32
->
msg
);
}
static
int
copyout_recv32
(
struct
ipmi_recv
*
p64
,
void
__user
*
to
)
...
...
@@ -789,10 +768,13 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
case
COMPAT_IPMICTL_SEND_COMMAND
:
{
struct
ipmi_req
rp
;
struct
compat_ipmi_req
r32
;
if
(
get_compat_ipmi_req
(
&
rp
,
compat_ptr
(
arg
)))
if
(
copy_from_user
(
&
r32
,
compat_ptr
(
arg
),
sizeof
(
r32
)))
return
-
EFAULT
;
get_compat_ipmi_req
(
&
rp
,
&
r32
);
return
handle_send_req
(
priv
->
user
,
&
rp
,
priv
->
default_retries
,
priv
->
default_retry_time_ms
);
...
...
@@ -800,10 +782,13 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
case
COMPAT_IPMICTL_SEND_COMMAND_SETTIME
:
{
struct
ipmi_req_settime
sp
;
struct
compat_ipmi_req_settime
sp32
;
if
(
get_compat_ipmi_req_settime
(
&
sp
,
compat_ptr
(
arg
)))
if
(
copy_from_user
(
&
sp32
,
compat_ptr
(
arg
),
sizeof
(
sp32
)))
return
-
EFAULT
;
get_compat_ipmi_req_settime
(
&
sp
,
&
sp32
);
return
handle_send_req
(
priv
->
user
,
&
sp
.
req
,
sp
.
retries
,
sp
.
retry_time_ms
);
}
...
...
@@ -811,11 +796,13 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd,
case
COMPAT_IPMICTL_RECEIVE_MSG_TRUNC
:
{
struct
ipmi_recv
recv64
;
struct
compat_ipmi_recv
recv32
;
memset
(
&
recv64
,
0
,
sizeof
(
recv64
));
if
(
get_compat_ipmi_recv
(
&
recv64
,
compat_ptr
(
arg
)))
if
(
copy_from_user
(
&
recv32
,
compat_ptr
(
arg
),
sizeof
(
recv32
)))
return
-
EFAULT
;
get_compat_ipmi_recv
(
&
recv64
,
&
recv32
);
return
handle_recv
(
priv
,
cmd
==
COMPAT_IPMICTL_RECEIVE_MSG_TRUNC
,
&
recv64
,
copyout_recv32
,
compat_ptr
(
arg
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录