aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-07-27 02:15:43 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-27 14:35:29 -0400
commit479432344420bc9a868088e346fecb6765e2b674 (patch)
tree08d57c28a83ba2c633c91df8490e37f6d4adc03f
parent463889e27e6f4f097374a6c9de5611f520766dad (diff)
net/netlabel: Correct redundant test
entry was tested for NULL near the beginning of the function, followed by a return, and there is no intervening modification of its value. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; expression E; position p1,p2; @@ if (x == NULL || ...) { ... when forall return ...; } ... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\) ( *x == NULL | *x != NULL ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/netlabel/netlabel_kapi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index b0e582f2d37a..3ff6f325be3f 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -185,8 +185,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
185 return 0; 185 return 0;
186 186
187cfg_unlbl_map_add_failure: 187cfg_unlbl_map_add_failure:
188 if (entry != NULL) 188 kfree(entry->domain);
189 kfree(entry->domain);
190 kfree(entry); 189 kfree(entry);
191 kfree(addrmap); 190 kfree(addrmap);
192 kfree(map4); 191 kfree(map4);
@@ -385,8 +384,7 @@ int netlbl_cfg_cipsov4_map_add(u32 doi,
385 384
386cfg_cipsov4_map_add_failure: 385cfg_cipsov4_map_add_failure:
387 cipso_v4_doi_putdef(doi_def); 386 cipso_v4_doi_putdef(doi_def);
388 if (entry != NULL) 387 kfree(entry->domain);
389 kfree(entry->domain);
390 kfree(entry); 388 kfree(entry);
391 kfree(addrmap); 389 kfree(addrmap);
392 kfree(addrinfo); 390 kfree(addrinfo);