From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 3/3] libbpf: remove unnecessary usdt_rel_ip assignments
Date: Tue, 5 Jul 2022 15:48:18 -0700 [thread overview]
Message-ID: <20220705224818.4026623-4-andrii@kernel.org> (raw)
In-Reply-To: <20220705224818.4026623-1-andrii@kernel.org>
Coverity detected that usdt_rel_ip is unconditionally overwritten
anyways, so there is no need to unnecessarily initialize it with unused
value. Clean this up.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/lib/bpf/usdt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
index 5159207cbfd9..d18e37982344 100644
--- a/tools/lib/bpf/usdt.c
+++ b/tools/lib/bpf/usdt.c
@@ -652,11 +652,9 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *
*
* [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
*/
- usdt_rel_ip = usdt_abs_ip = note.loc_addr;
- if (base_addr) {
+ usdt_abs_ip = note.loc_addr;
+ if (base_addr)
usdt_abs_ip += base_addr - note.base_addr;
- usdt_rel_ip += base_addr - note.base_addr;
- }
/* When attaching uprobes (which is what USDTs basically are)
* kernel expects file offset to be specified, not a relative
--
2.30.2
next prev parent reply other threads:[~2022-07-05 22:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 22:48 [PATCH bpf-next 0/3] Fix few compiler warnings in selftests and libbpf Andrii Nakryiko
2022-07-05 22:48 ` [PATCH bpf-next 1/3] selftests/bpf: fix bogus uninitialized variable warning Andrii Nakryiko
2022-07-05 22:48 ` [PATCH bpf-next 2/3] selftests/bpf: fix few more compiler warnings Andrii Nakryiko
2022-07-05 22:48 ` Andrii Nakryiko [this message]
2022-07-06 6:47 ` [PATCH bpf-next 0/3] Fix few compiler warnings in selftests and libbpf Yonghong Song
2022-07-06 8:11 ` Jiri Olsa
2022-07-06 14:50 ` patchwork-bot+netdevbpf
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=20220705224818.4026623-4-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
/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