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]
Date:	Mon, 21 Jan 2013 14:02:45 +0100
From:	Julia Lawall <Julia.Lawall@...6.fr>
To:	Paul Mundt <lethal@...ux-sh.org>
Cc:	kernel-janitors@...r.kernel.org, Simon Horman <horms@...ge.net.au>,
	Magnus Damm <magnus.damm@...il.com>, linux-sh@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/15] drivers/sh/intc/of_intc.c: adjust duplicate test

From: Julia Lawall <Julia.Lawall@...6.fr>

Delete successive tests to the same location.  In this case intc_node has
already been tested for being NULL, and calling of_find_node_by_name will
not make it NULL.  On the other hand, of_find_node_by_name can return NULL
on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@s exists@
local idexpression y;
expression x,e;
@@

*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
    when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
*if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
 { ... when forall
   return ...; }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>

---
 drivers/sh/intc/of_intc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/sh/intc/of_intc.c b/drivers/sh/intc/of_intc.c
index 1d5f47e..8dfded3 100644
--- a/drivers/sh/intc/of_intc.c
+++ b/drivers/sh/intc/of_intc.c
@@ -330,7 +330,7 @@ static int __init of_sh_intc_get_prio(struct device_node *np,
 
 		reg_node = of_find_node_by_name(intc_node, node_name);
 
-		if (!intc_node) {
+		if (!reg_node) {
 			pr_err("INTC prio register not found\n");
 			ret = -EINVAL;
 			goto error;
@@ -386,7 +386,7 @@ static int __init of_sh_intc_get_sense(struct device_node *np,
 
 		reg_node = of_find_node_by_name(intc_node, node_name);
 
-		if (!intc_node) {
+		if (!reg_node) {
 			pr_err("INTC senses register not found\n");
 			ret = -EINVAL;
 			goto error;

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