summaryrefslogtreecommitdiffstats
path: root/samples/bpf/tracex1_kern.c
diff options
context:
space:
mode:
authorDaniel Borkmann2016-04-13 00:10:53 +0200
committerDavid S. Miller2016-04-15 03:40:42 +0200
commit02413cabd6b67f1444f153ea85d44076deae2056 (patch)
tree8d656100a8e523f2f9a5256884f6c868c0ae94df /samples/bpf/tracex1_kern.c
parentbpf: convert relevant helper args to ARG_PTR_TO_RAW_STACK (diff)
downloadkernel-qcow2-linux-02413cabd6b67f1444f153ea85d44076deae2056.tar.gz
kernel-qcow2-linux-02413cabd6b67f1444f153ea85d44076deae2056.tar.xz
kernel-qcow2-linux-02413cabd6b67f1444f153ea85d44076deae2056.zip
bpf, samples: don't zero data when not needed
Remove the zero initialization in the sample programs where appropriate. Note that this is an optimization which is now possible, old programs still doing the zero initialization are just fine as well. Also, make sure we don't have padding issues when we don't memset() the entire struct anymore. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/tracex1_kern.c')
-rw-r--r--samples/bpf/tracex1_kern.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/samples/bpf/tracex1_kern.c b/samples/bpf/tracex1_kern.c
index 3f450a8fa1f3..107da148820f 100644
--- a/samples/bpf/tracex1_kern.c
+++ b/samples/bpf/tracex1_kern.c
@@ -23,16 +23,14 @@ int bpf_prog1(struct pt_regs *ctx)
/* attaches to kprobe netif_receive_skb,
* looks for packets on loobpack device and prints them
*/
- char devname[IFNAMSIZ] = {};
+ char devname[IFNAMSIZ];
struct net_device *dev;
struct sk_buff *skb;
int len;
/* non-portable! works for the given kernel only */
skb = (struct sk_buff *) PT_REGS_PARM1(ctx);
-
dev = _(skb->dev);
-
len = _(skb->len);
bpf_probe_read(devname, sizeof(devname), dev->name);