[PATCH 12/12] tools: Correct redundant test

From: Julia Lawall
Date: Mon Jul 27 2009 - 12:19:46 EST


From: Julia Lawall <julia@xxxxxxx>

symstrs has already been tested. It seems that this test should be on the
recently returned value secstrs.

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

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

---
tools/perf/util/symbol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2810605..b4fe057 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -565,7 +565,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
goto out_elf_end;

secstrs = elf_getdata(sec_strndx, NULL);
- if (symstrs == NULL)
+ if (secstrs == NULL)
goto out_elf_end;

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