Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c7b1b249
Commit
c7b1b249
authored
Nov 21, 2006
by
Arnaldo Carvalho de Melo
Committed by
David S. Miller
Dec 02, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCHED]: Use kmemdup & kzalloc where appropriate
Signed-off-by:
Arnaldo Carvalho de Melo
<
acme@mandriva.com
>
parent
b3ab09f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
15 deletions
+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
No files found.
net/sched/act_ipt.c
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment