Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
c7b1b249
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c7b1b249
编写于
11月 21, 2006
作者:
A
Arnaldo Carvalho de Melo
提交者:
David S. Miller
12月 02, 2006
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SCHED]: Use kmemdup & kzalloc where appropriate
Signed-off-by:
N
Arnaldo Carvalho de Melo
<
acme@mandriva.com
>
上级
b3ab09f9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
7 addition
and
15 deletion
+7
-15
net/sched/act_ipt.c
net/sched/act_ipt.c
+2
-4
net/sched/act_simple.c
net/sched/act_simple.c
+1
-2
net/sched/cls_api.c
net/sched/cls_api.c
+1
-2
net/sched/em_meta.c
net/sched/em_meta.c
+1
-2
net/sched/em_nbyte.c
net/sched/em_nbyte.c
+1
-3
net/sched/ematch.c
net/sched/ematch.c
+1
-2
未找到文件。
net/sched/act_ipt.c
浏览文件 @
c7b1b249
...
...
@@ -156,10 +156,9 @@ static int tcf_ipt_init(struct rtattr *rta, struct rtattr *est,
rtattr_strlcpy
(
tname
,
tb
[
TCA_IPT_TABLE
-
1
],
IFNAMSIZ
)
>=
IFNAMSIZ
)
strcpy
(
tname
,
"mangle"
);
t
=
km
alloc
(
td
->
u
.
target_size
,
GFP_KERNEL
);
t
=
km
emdup
(
td
,
td
->
u
.
target_size
,
GFP_KERNEL
);
if
(
unlikely
(
!
t
))
goto
err2
;
memcpy
(
t
,
td
,
td
->
u
.
target_size
);
if
((
err
=
ipt_init_target
(
t
,
tname
,
hook
))
<
0
)
goto
err3
;
...
...
@@ -256,13 +255,12 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
** for foolproof you need to not assume this
*/
t
=
km
alloc
(
ipt
->
tcfi_t
->
u
.
user
.
target_size
,
GFP_ATOMIC
);
t
=
km
emdup
(
ipt
->
tcfi_t
,
ipt
->
tcfi_t
->
u
.
user
.
target_size
,
GFP_ATOMIC
);
if
(
unlikely
(
!
t
))
goto
rtattr_failure
;
c
.
bindcnt
=
ipt
->
tcf_bindcnt
-
bind
;
c
.
refcnt
=
ipt
->
tcf_refcnt
-
ref
;
memcpy
(
t
,
ipt
->
tcfi_t
,
ipt
->
tcfi_t
->
u
.
user
.
target_size
);
strcpy
(
t
->
u
.
user
.
name
,
ipt
->
tcfi_t
->
u
.
kernel
.
target
->
name
);
RTA_PUT
(
skb
,
TCA_IPT_TARG
,
ipt
->
tcfi_t
->
u
.
user
.
target_size
,
t
);
...
...
net/sched/act_simple.c
浏览文件 @
c7b1b249
...
...
@@ -71,11 +71,10 @@ static int tcf_simp_release(struct tcf_defact *d, int bind)
static
int
alloc_defdata
(
struct
tcf_defact
*
d
,
u32
datalen
,
void
*
defdata
)
{
d
->
tcfd_defdata
=
km
alloc
(
datalen
,
GFP_KERNEL
);
d
->
tcfd_defdata
=
km
emdup
(
defdata
,
datalen
,
GFP_KERNEL
);
if
(
unlikely
(
!
d
->
tcfd_defdata
))
return
-
ENOMEM
;
d
->
tcfd_datalen
=
datalen
;
memcpy
(
d
->
tcfd_defdata
,
defdata
,
datalen
);
return
0
;
}
...
...
net/sched/cls_api.c
浏览文件 @
c7b1b249
...
...
@@ -217,7 +217,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
/* Create new proto tcf */
err
=
-
ENOBUFS
;
if
((
tp
=
k
m
alloc
(
sizeof
(
*
tp
),
GFP_KERNEL
))
==
NULL
)
if
((
tp
=
k
z
alloc
(
sizeof
(
*
tp
),
GFP_KERNEL
))
==
NULL
)
goto
errout
;
err
=
-
EINVAL
;
tp_ops
=
tcf_proto_lookup_ops
(
tca
[
TCA_KIND
-
1
]);
...
...
@@ -247,7 +247,6 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
kfree
(
tp
);
goto
errout
;
}
memset
(
tp
,
0
,
sizeof
(
*
tp
));
tp
->
ops
=
tp_ops
;
tp
->
protocol
=
protocol
;
tp
->
prio
=
nprio
?
:
tcf_auto_prio
(
*
back
);
...
...
net/sched/em_meta.c
浏览文件 @
c7b1b249
...
...
@@ -546,10 +546,9 @@ static int meta_var_change(struct meta_value *dst, struct rtattr *rta)
{
int
len
=
RTA_PAYLOAD
(
rta
);
dst
->
val
=
(
unsigned
long
)
kmalloc
(
len
,
GFP_KERNEL
);
dst
->
val
=
(
unsigned
long
)
kmemdup
(
RTA_DATA
(
rta
),
len
,
GFP_KERNEL
);
if
(
dst
->
val
==
0UL
)
return
-
ENOMEM
;
memcpy
((
void
*
)
dst
->
val
,
RTA_DATA
(
rta
),
len
);
dst
->
len
=
len
;
return
0
;
}
...
...
net/sched/em_nbyte.c
浏览文件 @
c7b1b249
...
...
@@ -34,12 +34,10 @@ static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
return
-
EINVAL
;
em
->
datalen
=
sizeof
(
*
nbyte
)
+
nbyte
->
len
;
em
->
data
=
(
unsigned
long
)
kmalloc
(
em
->
datalen
,
GFP_KERNEL
);
em
->
data
=
(
unsigned
long
)
kmemdup
(
data
,
em
->
datalen
,
GFP_KERNEL
);
if
(
em
->
data
==
0UL
)
return
-
ENOBUFS
;
memcpy
((
void
*
)
em
->
data
,
data
,
em
->
datalen
);
return
0
;
}
...
...
net/sched/ematch.c
浏览文件 @
c7b1b249
...
...
@@ -251,12 +251,11 @@ static int tcf_em_validate(struct tcf_proto *tp,
goto
errout
;
em
->
data
=
*
(
u32
*
)
data
;
}
else
{
void
*
v
=
km
alloc
(
data_len
,
GFP_KERNEL
);
void
*
v
=
km
emdup
(
data
,
data_len
,
GFP_KERNEL
);
if
(
v
==
NULL
)
{
err
=
-
ENOBUFS
;
goto
errout
;
}
memcpy
(
v
,
data
,
data_len
);
em
->
data
=
(
unsigned
long
)
v
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录