From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin Ian King <colin.king@canonical.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] samples: bpf: ensure that we don't load over MAX_PROGS programs
Date: Fri, 13 Jul 2018 18:15:41 +0300 [thread overview]
Message-ID: <20180713151541.m6ksulnjb6qsh24w@mwanda> (raw)
In-Reply-To: <a3397e41-7e57-d4c2-96e0-427d9386444a@canonical.com>
On Fri, Jul 13, 2018 at 04:13:30PM +0100, Colin Ian King wrote:
> On 13/07/18 16:11, Dan Carpenter wrote:
> > I can't see that we check prog_cnt to ensure it doesn't go over
> > MAX_PROGS.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> > index 89161c9ed466..904e775d1a44 100644
> > --- a/samples/bpf/bpf_load.c
> > +++ b/samples/bpf/bpf_load.c
> > @@ -107,6 +107,9 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
> > return -1;
> > }
> >
> > + if (prog_cnt == MAX_PROGS)
> > + return -1;
> > +
>
> Should that be "if (prog_cnt >= MAX_PROGS)" ?
It's incremented one at a time so it can't go over.
regards,
dan carpenter
prev parent reply other threads:[~2018-07-13 15:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 15:11 [PATCH 1/2] samples: bpf: ensure that we don't load over MAX_PROGS programs Dan Carpenter
2018-07-13 15:13 ` Colin Ian King
2018-07-13 15:15 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180713151541.m6ksulnjb6qsh24w@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ast@kernel.org \
--cc=colin.king@canonical.com \
--cc=daniel@iogearbox.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox