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-next>] [day] [month] [year] [list]
Date:   Tue, 18 May 2021 14:07:25 +0800
From:   zuoqilin1@....com
To:     robh+dt@...nel.org, frowand.list@...il.com
Cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        zuoqilin <zuoqilin@...ong.com>
Subject: [PATCH] scripts/dtc: Assign value when defining variables

From: zuoqilin <zuoqilin@...ong.com>

When defining variables and assigning values can be done at the same time.

Signed-off-by: zuoqilin <zuoqilin@...ong.com>
---
 scripts/dtc/util.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
index 40274fb..d1f7608 100644
--- a/scripts/dtc/util.c
+++ b/scripts/dtc/util.c
@@ -292,7 +292,7 @@ int utilfdt_write_err(const char *filename, const void *blob)
 {
 	int fd = 1;	/* assume stdout */
 	int totalsize;
-	int offset;
+	int offset = 0;
 	int ret = 0;
 	const char *ptr = blob;
 
@@ -303,7 +303,6 @@ int utilfdt_write_err(const char *filename, const void *blob)
 	}
 
 	totalsize = fdt_totalsize(blob);
-	offset = 0;
 
 	while (offset < totalsize) {
 		ret = write(fd, ptr + offset, totalsize - offset);
@@ -421,7 +420,7 @@ void NORETURN util_usage(const char *errmsg, const char *synopsis,
 	const char a_arg[] = "<arg>";
 	size_t a_arg_len = strlen(a_arg) + 1;
 	size_t i;
-	int optlen;
+	int optlen = 0;
 
 	fprintf(fp,
 		"Usage: %s\n"
@@ -429,7 +428,6 @@ void NORETURN util_usage(const char *errmsg, const char *synopsis,
 		"Options: -[%s]\n", synopsis, short_opts);
 
 	/* prescan the --long opt length to auto-align */
-	optlen = 0;
 	for (i = 0; long_opts[i].name; ++i) {
 		/* +1 is for space between --opt and help text */
 		int l = strlen(long_opts[i].name) + 1;
-- 
1.9.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ