aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_bpf.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2016-10-26 10:53:16 +0200
committerDavid S. Miller <davem@davemloft.net>2016-10-29 14:57:42 -0400
commitb15ca182ed136087f6a2cb9ffe880c923f36a56e (patch)
tree9f5b9829fdeb6491eae3c19d92a1a3a80e19f31d /net/sched/cls_bpf.c
parentnet: ip, diag: include net/inet_sock.h (diff)
downloadlinux-dev-b15ca182ed136087f6a2cb9ffe880c923f36a56e.tar.xz
linux-dev-b15ca182ed136087f6a2cb9ffe880c923f36a56e.zip
netlink: Add nla_memdup() to wrap kmemdup() use on nlattr
Wrap several common instances of: kmemdup(nla_data(attr), nla_len(attr), GFP_KERNEL); Signed-off-by: Thomas Graf <tgraf@suug.ch> Acked-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_bpf.c')
-rw-r--r--net/sched/cls_bpf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index bb1d5a487081..52dc85acca7d 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -369,9 +369,7 @@ static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog,
return PTR_ERR(fp);
if (tb[TCA_BPF_NAME]) {
- name = kmemdup(nla_data(tb[TCA_BPF_NAME]),
- nla_len(tb[TCA_BPF_NAME]),
- GFP_KERNEL);
+ name = nla_memdup(tb[TCA_BPF_NAME], GFP_KERNEL);
if (!name) {
bpf_prog_put(fp);
return -ENOMEM;