From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [PATCH] tools/bpftool: silence a static check warning Date: Mon, 15 Jan 2018 11:15:47 +0300 Message-ID: <20180115081547.bf2u3aqitnm3bmtl@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org To: Alexei Starovoitov , Daniel Borkmann Return-path: Received: from userp2130.oracle.com ([156.151.31.86]:49218 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753926AbeAOIQM (ORCPT ); Mon, 15 Jan 2018 03:16:12 -0500 Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: 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 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(®ex); return NULL; } - if (proglen > 1000000) { + if (proglen < 0 || proglen > 1000000) { printf("proglen of %d too big, stopping\n", proglen); return NULL; }