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: <1348756117-5299-1-git-send-email-maximlevitsky@gmail.com>
Date:	Thu, 27 Sep 2012 16:28:37 +0200
From:	Maxim Levitsky <maximlevitsky@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Alex Dubov <oakad@...oo.com>, linux-kernel@...r.kernel.org,
	Tejun Heo <tj@...nel.org>, Jens Axboe <axboe@...nel.dk>,
	Maxim Levitsky <maximlevitsky@...il.com>
Subject: [PATCH] scatterlist: refactor the sg_nents

Replace 'while' with 'for' as suggested by Tejun Heo

Signed-off-by: Maxim Levitsky <maximlevitsky@...il.com>
---
 lib/scatterlist.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 5cd9cdc..3675452b 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -49,12 +49,9 @@ EXPORT_SYMBOL(sg_next);
  **/
 int sg_nents(struct scatterlist *sg)
 {
-	int nents = 0;
-	while (sg) {
+	int nents;
+	for (nents = 0; sg; sg = sg_next(sg))
 		nents++;
-		sg = sg_next(sg);
-	}
-
 	return nents;
 }
 EXPORT_SYMBOL(sg_nents);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ