lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241112060103.282531-1-luoyifan@cmss.chinamobile.com>
Date: Tue, 12 Nov 2024 14:01:03 +0800
From: Luo Yifan <luoyifan@...s.chinamobile.com>
To: acme@...nel.org
Cc: adrian.hunter@...el.com,
	alexander.shishkin@...ux.intel.com,
	irogers@...gle.com,
	jolsa@...nel.org,
	kan.liang@...ux.intel.com,
	linux-kernel@...r.kernel.org,
	linux-perf-users@...r.kernel.org,
	luoyifan@...s.chinamobile.com,
	mark.rutland@....com,
	mingo@...hat.com,
	namhyung@...nel.org,
	peterz@...radead.org
Subject: [PATCH] perf jvmti: Remove unnecessary ret variable in jvmti_write_code

Following the approach in the jvmti_write_debug_info function, just
remove the ret variable from jvmti_write_code function. It's safe since
we don’t really care about the return value of fwrite_unlocked. This
change makes the code cleaner and more compiler-friendly.

Signed-off-by: Luo Yifan <luoyifan@...s.chinamobile.com>
---
 tools/perf/jvmti/jvmti_agent.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
index 526dcaf9f..9b49a880b 100644
--- a/tools/perf/jvmti/jvmti_agent.c
+++ b/tools/perf/jvmti/jvmti_agent.c
@@ -363,7 +363,6 @@ jvmti_write_code(void *agent, char const *sym,
 	struct jr_code_load rec;
 	size_t sym_len;
 	FILE *fp = agent;
-	int ret = -1;
 
 	/* don't care about 0 length function, no samples */
 	if (size == 0)
@@ -400,7 +399,7 @@ jvmti_write_code(void *agent, char const *sym,
 	 */
 	rec.code_index = code_generation++;
 
-	ret = fwrite_unlocked(&rec, sizeof(rec), 1, fp);
+	fwrite_unlocked(&rec, sizeof(rec), 1, fp);
 	fwrite_unlocked(sym, sym_len, 1, fp);
 
 	if (code)
@@ -408,9 +407,7 @@ jvmti_write_code(void *agent, char const *sym,
 
 	funlockfile(fp);
 
-	ret = 0;
-
-	return ret;
+	return 0;
 }
 
 int
-- 
2.27.0




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ