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: <m26359qplh.fsf@ssh.synack.fr>
Date:	Sat, 06 Mar 2010 19:20:26 +0100
From:	Samir Bellabes <sam@...ack.fr>
To:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc:	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	netfilter-devel@...r.kernel.org, hadi@...erus.ca, kaber@...sh.net,
	zbr@...emap.net, nhorman@...driver.com, root@...aldomain.pl,
	linux-security-module@...r.kernel.org
Subject: Re: [RFC v2 00/10] snet: Security for NETwork syscalls

Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp> writes:

> Regarding [RFC v2 06/10] snet: introduce snet_hooks
> +                       if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
>
> Please avoid assignment in "if" statement, as scripts/checkpatch.pl suggests.

Right, I should have run script/checkpatch.pl on this set of patches. I
won't miss it next time. 

Thanks Tetsuo.
sam

>From ea2234c07ea1bf76579ba127c8a8be6ab276515f Mon Sep 17 00:00:00 2001
From: Samir Bellabes <sam@...ack.fr>
Date: Sat, 6 Mar 2010 17:49:22 +0100
Subject: [PATCH 3/3] snet: avoid assigment in if statement

Noticed by Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>

Signed-off-by: Samir Bellabes <sam@...ack.fr>
---
 security/snet/snet_hooks.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/security/snet/snet_hooks.c b/security/snet/snet_hooks.c
index 689babe..d9cf0b9 100644
--- a/security/snet/snet_hooks.c
+++ b/security/snet/snet_hooks.c
@@ -160,7 +160,8 @@ static int snet_socket_bind(struct socket *sock,
 			info.dst.u3.ip = inet->inet_daddr;
 			info.src.u.port = ntohs(a->sin_port);
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info) ;
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -173,7 +174,8 @@ static int snet_socket_bind(struct socket *sock,
 			       sizeof(info.dst.u3.ip6));
 			info.src.u.port = ntohs(a6->sin6_port);
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -229,7 +231,8 @@ static int snet_socket_connect(struct socket *sock,
 			info.dst.u3.ip = a->sin_addr.s_addr;
 			info.dst.u.port = ntohs(a->sin_port);
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -242,7 +245,8 @@ static int snet_socket_connect(struct socket *sock,
 			       sizeof(info.dst.u3.ip6));
 			info.dst.u.port = ntohs(a6->sin6_port);
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -295,7 +299,8 @@ static int snet_socket_listen(struct socket *sock, int backlog)
 			info.src.u3.ip = inet->inet_saddr;
 			info.dst.u3.ip = inet->inet_daddr;
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -306,7 +311,9 @@ static int snet_socket_listen(struct socket *sock, int backlog)
 			       sizeof(info.src.u3.ip6));
 			memcpy(&info.dst.u3.ip6, (void *)&inet->pinet6->daddr,
 			       sizeof(info.dst.u3.ip6));
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			/* check tickets */
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -358,7 +365,8 @@ static int snet_socket_accept(struct socket *sock, struct socket *newsock)
 			info.src.u3.ip = inet->inet_saddr;
 			info.dst.u3.ip = inet->inet_daddr;
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -370,7 +378,8 @@ static int snet_socket_accept(struct socket *sock, struct socket *newsock)
 			memcpy(&info.dst.u3.ip6, (void *)&inet->pinet6->daddr,
 			       sizeof(info.dst.u3.ip6));
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -470,7 +479,8 @@ static int snet_socket_sendmsg(struct socket *sock,
 			info.src.u3.ip = inet->inet_saddr;
 			info.dst.u3.ip = inet->inet_daddr;
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -482,7 +492,8 @@ static int snet_socket_sendmsg(struct socket *sock,
 			memcpy(&info.dst.u3.ip6, (void *)&inet->pinet6->daddr,
 			       sizeof(info.dst.u3.ip6));
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -535,7 +546,8 @@ static int snet_socket_recvmsg(struct socket *sock,
 			info.src.u3.ip = inet->inet_saddr;
 			info.dst.u3.ip = inet->inet_daddr;
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
@@ -547,7 +559,8 @@ static int snet_socket_recvmsg(struct socket *sock,
 			memcpy(&info.dst.u3.ip6, (void *)&inet->pinet6->daddr,
 			       sizeof(info.dst.u3.ip6));
 			/* check tickets */
-			if ((verdict = snet_ticket_check(&info)) != SNET_VERDICT_NONE)
+			verdict = snet_ticket_check(&info);
+			if (verdict != SNET_VERDICT_NONE)
 				goto out;
 			/* inserting verdict PENDING */
 			info.verdict_id = snet_verdict_insert();
-- 
1.6.3.3

--
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