All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@fb.com>,
	<daniel@iogearbox.net>
Cc: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: [PATCH bpf-next 2/5] libbpf: fix potential overflow issue
Date: Wed, 6 Nov 2019 18:08:52 -0800	[thread overview]
Message-ID: <20191107020855.3834758-3-andriin@fb.com> (raw)
In-Reply-To: <20191107020855.3834758-1-andriin@fb.com>

Fix a potential overflow issue found by LGTM analysis, based on Github libbpf
source code.

Fixes: 3d65014146c6 ("bpf: libbpf: Add btf_line_info support to libbpf")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index ca0d635b1d5e..b3e3e99a0f28 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -189,7 +189,7 @@ static void *
 alloc_zero_tailing_info(const void *orecord, __u32 cnt,
 			__u32 actual_rec_size, __u32 expected_rec_size)
 {
-	__u64 info_len = actual_rec_size * cnt;
+	__u64 info_len = (__u64)actual_rec_size * cnt;
 	void *info, *nrecord;
 	int i;
 
-- 
2.17.1


  parent reply	other threads:[~2019-11-07  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  2:08 [PATCH bpf-next 0/5] Fix bugs and issues found by static analysis in libbpf Andrii Nakryiko
2019-11-07  2:08 ` [PATCH bpf-next 1/5] libbpf: fix memory leak/double free issue Andrii Nakryiko
2019-11-07  2:08 ` Andrii Nakryiko [this message]
2019-11-07  2:08 ` [PATCH bpf-next 3/5] libbpf: fix another potential overflow issue in bpf_prog_linfo Andrii Nakryiko
2019-11-07  2:08 ` [PATCH bpf-next 4/5] libbpf: make btf__resolve_size logic always check size error condition Andrii Nakryiko
2019-11-07  2:08 ` [PATCH bpf-next 5/5] libbpf: improve handling of corrupted ELF during map initialization Andrii Nakryiko
2019-11-07 16:35 ` [PATCH bpf-next 0/5] Fix bugs and issues found by static analysis in libbpf 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=20191107020855.3834758-3-andriin@fb.com \
    --to=andriin@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.