summaryrefslogtreecommitdiff
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2014-10-28 12:00:39 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2014-10-28 12:00:39 +0000
commit0e1152fcc2fe48dea2583ac89d30ba77b4ab78cc (patch)
tree63f2365a6dbce30caad91ca3b5ad545a2e4beb51 /sys/net/bpf.c
parentfb7830888d63404404f597b4680dd8150fd5ae0c (diff)
downloadsrc-test2-0e1152fcc2fe48dea2583ac89d30ba77b4ab78cc.tar.gz
src-test2-0e1152fcc2fe48dea2583ac89d30ba77b4ab78cc.zip
Notes
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 91a453a6d97b..92a3b30f5f07 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -2807,7 +2807,8 @@ bpfstats_fill_xbpf(struct xbpf_d *d, struct bpf_d *bd)
static int
bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
{
- struct xbpf_d *xbdbuf, *xbd, zerostats;
+ static const struct xbpf_d zerostats;
+ struct xbpf_d *xbdbuf, *xbd, tempstats;
int index, error;
struct bpf_if *bp;
struct bpf_d *bd;
@@ -2827,11 +2828,13 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
* as we aren't allowing the user to set the counters currently.
*/
if (req->newptr != NULL) {
- if (req->newlen != sizeof(zerostats))
+ if (req->newlen != sizeof(tempstats))
return (EINVAL);
- bzero(&zerostats, sizeof(zerostats));
- xbd = req->newptr;
- if (bcmp(xbd, &zerostats, sizeof(*xbd)) != 0)
+ memset(&tempstats, 0, sizeof(tempstats));
+ error = SYSCTL_IN(req, &tempstats, sizeof(tempstats));
+ if (error)
+ return (error);
+ if (bcmp(&tempstats, &zerostats, sizeof(tempstats)) != 0)
return (EINVAL);
bpf_zero_counters();
return (0);