Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
06458191
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06458191
编写于
5月 27, 2006
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] copy_to_user() from iomem is a bad thing
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
6bc540e6
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
4 deletion
+16
-4
drivers/char/rio/rioctrl.c
drivers/char/rio/rioctrl.c
+16
-4
未找到文件。
drivers/char/rio/rioctrl.c
浏览文件 @
06458191
...
...
@@ -126,6 +126,18 @@ static int
#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
static
int
copy_from_io
(
void
__user
*
to
,
void
__iomem
*
from
,
size_t
size
)
{
void
*
buf
=
kmalloc
(
size
,
GFP_KERNEL
);
int
res
=
-
ENOMEM
;
if
(
buf
)
{
rio_memcpy_fromio
(
buf
,
from
,
size
);
res
=
copy_to_user
(
to
,
buf
,
size
);
kfree
(
buf
);
}
return
res
;
}
int
riocontrol
(
struct
rio_info
*
p
,
dev_t
dev
,
int
cmd
,
unsigned
long
arg
,
int
su
)
{
uint
Host
;
/* leave me unsigned! */
...
...
@@ -893,7 +905,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
** Fetch the parmmap
*/
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_PARMS
\n
"
);
if
(
copy_
to_user
(
argp
,
p
->
RIOHosts
[
host
].
ParmMapP
,
sizeof
(
PARM_MAP
)))
{
if
(
copy_
from_io
(
argp
,
p
->
RIOHosts
[
host
].
ParmMapP
,
sizeof
(
PARM_MAP
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_PARMS: Copy out to user space failed
\n
"
);
return
-
EFAULT
;
...
...
@@ -947,7 +959,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_DPRAM: Bad copy to user space
\n
"
);
return
-
EFAULT
;
}
}
else
if
(
copy_
to_user
(
HostDpRam
.
DpRamP
,
p
->
RIOHosts
[
HostDpRam
.
HostNum
].
Caddr
,
sizeof
(
struct
DpRam
)))
{
}
else
if
(
copy_
from_io
(
HostDpRam
.
DpRamP
,
p
->
RIOHosts
[
HostDpRam
.
HostNum
].
Caddr
,
sizeof
(
struct
DpRam
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_DPRAM: Bad copy to user space
\n
"
);
return
-
EFAULT
;
...
...
@@ -1021,7 +1033,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
}
rio_dprintk
(
RIO_DEBUG_CTRL
,
"Request for rup %d from host %d
\n
"
,
RupReq
.
RupNum
,
RupReq
.
HostNum
);
if
(
copy_
to_user
(
RupReq
.
RupP
,
HostP
->
UnixRups
[
RupReq
.
RupNum
].
RupP
,
sizeof
(
struct
RUP
)))
{
if
(
copy_
from_io
(
RupReq
.
RupP
,
HostP
->
UnixRups
[
RupReq
.
RupNum
].
RupP
,
sizeof
(
struct
RUP
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_RUP: Bad copy to user space
\n
"
);
return
-
EFAULT
;
...
...
@@ -1058,7 +1070,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
}
rio_dprintk
(
RIO_DEBUG_CTRL
,
"Request for lpb %d from host %d
\n
"
,
LpbReq
.
Link
,
LpbReq
.
Host
);
if
(
copy_
to_user
(
LpbReq
.
LpbP
,
&
HostP
->
LinkStrP
[
LpbReq
.
Link
],
sizeof
(
struct
LPB
)))
{
if
(
copy_
from_io
(
LpbReq
.
LpbP
,
&
HostP
->
LinkStrP
[
LpbReq
.
Link
],
sizeof
(
struct
LPB
)))
{
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_LPB: Bad copy to user space
\n
"
);
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
return
-
EFAULT
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录