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>] [day] [month] [year] [list]
Message-ID: <20181023012031.GA6920@WindFlash>
Date:   Mon, 22 Oct 2018 22:20:31 -0300
From:   Leonardo Brás <leobras.c@...il.com>
To:     lkcamp@...ts.libreplanetbr.org
Cc:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] Changes style to look more like list iteration.

Changes the code in order to make it looks more like its a list iteration.

Signed-off-by: Leonardo Brás <leobras.c@...il.com>
---

It's a remainer from a patch from the -Wshadow patchset.
Since it doesn't really belongs to that patchset anymore, 
I decided to release it just as a code refactor for
file2alias.c

I fixed it after Koike's suggestion (&&!dup added)

IMHO it reads better this way, and no drastic change has been made.

Thanks.

---
 scripts/mod/file2alias.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 3015c0bdecb2..b957279c4117 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -650,26 +650,26 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
 
 	device_id_check(mod->name, "pnp", size, id_size, symval);
 	DEF_FIELD_ADDR(symval, pnp_card_device_id, devs);
-	typeof(devs) devs_last;
+	DEF_FIELD_ADDR_VAR(symval, pnp_card_device_id, devs, devs_aux);
 
 	for (i = 0; i < count; i++) {
 		unsigned int j;
-		devs_last = devs + i * id_size;
+		devs_aux = devs + i * id_size;
 
 		for (j = 0; j < PNP_MAX_DEVICES; j++) {
-			const char *id = (char *)(*devs_last)[j].id;
+			const char *id = (char *)(*devs_aux)[j].id;
 			int j2;
 			int dup = 0;
 
 			if (!id[0])
 				break;
 
-			/* find duplicate, already added value */
-			while ((devs_last -= id_size) >= devs && !dup) {
+			/* find duplicate on previous devs*/
+			while ((devs_aux -= id_size) >= devs && !dup) {
 
 				for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
 					const char *id2 =
-						(char *)(*devs_last)[j2].id;
+						(char *)(*devs_aux)[j2].id;
 
 					if (!id2[0])
 						break;
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ