public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] tools/bpftool: silence a static check warning
Date: Mon, 15 Jan 2018 11:15:47 +0300	[thread overview]
Message-ID: <20180115081547.bf2u3aqitnm3bmtl@mwanda> (raw)

There is a static checker warning that proglen has an upper bound but no
lower bound.  The allocation will just fail harmlessly so it's not a big
deal.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/tools/bpf/bpf_jit_disasm.c b/tools/bpf/bpf_jit_disasm.c
index 30044bc4f389..2d7bb5dc0b8c 100644
--- a/tools/bpf/bpf_jit_disasm.c
+++ b/tools/bpf/bpf_jit_disasm.c
@@ -205,7 +205,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
 		regfree(&regex);
 		return NULL;
 	}
-	if (proglen > 1000000) {
+	if (proglen < 0 || proglen > 1000000) {
 		printf("proglen of %d too big, stopping\n", proglen);
 		return NULL;
 	}

             reply	other threads:[~2018-01-15  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  8:15 Dan Carpenter [this message]
2018-01-15 10:35 ` [PATCH] tools/bpftool: silence a static check warning Daniel Borkmann
2018-01-18  9:35   ` [PATCH v2] tools/bpftool: silence a static checker warning Dan Carpenter
2018-01-18 21:23     ` Daniel Borkmann

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=20180115081547.bf2u3aqitnm3bmtl@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ast@kernel.org \
    --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