Linux-Sparse Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] gensel: remove unneeded test/uninitialized warning
@ 2020-06-22 22:38 Luc Van Oostenryck
  2020-06-22 22:38 ` Luc Van Oostenryck
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-06-22 22:38 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck, Ramsay Jones

When evaluation generic selections, it is tested if the type in
the selection is a SYM_NODE or not, but:
* all these are SYM_NODE
* the variable for the base type would be uninitialized
  if not a SYM_NODE.

So, remove the test and unconditionally set the base type.

Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index aa0f208006bb..461c2547285f 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3304,9 +3304,7 @@ static struct symbol *evaluate_generic_selection(struct expression *expr)
 		if (!evaluate_symbol(stype))
 			continue;
 
-		if (stype->type == SYM_NODE)
-			base = stype->ctype.base_type;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] gensel: remove unneeded test/uninitialized warning
  2020-06-22 22:38 [PATCH] gensel: remove unneeded test/uninitialized warning Luc Van Oostenryck
@ 2020-06-22 22:38 ` Luc Van Oostenryck
  0 siblings, 0 replies; 2+ messages in thread
From: Luc Van Oostenryck @ 2020-06-22 22:38 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck, Ramsay Jones

When evaluation generic selections, it is tested if the type in
the selection is a SYM_NODE or not, but:
* all these are SYM_NODE
* the variable for the base type would be uninitialized
  if not a SYM_NODE.

So, remove the test and unconditionally set the base type.

Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index aa0f208006bb..461c2547285f 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3304,9 +3304,7 @@ static struct symbol *evaluate_generic_selection(struct expression *expr)
 		if (!evaluate_symbol(stype))
 			continue;
 
-		if (stype->type == SYM_NODE)
-			base = stype->ctype.base_type;
-
+		base = stype->ctype.base_type;
 		if (base->type == SYM_ARRAY && base->array_size) {
 			get_expression_value_silent(base->array_size);
 			if (base->array_size->type == EXPR_VALUE)
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 22:38 [PATCH] gensel: remove unneeded test/uninitialized warning Luc Van Oostenryck
2020-06-22 22:38 ` Luc Van Oostenryck

Linux-Sparse Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-sparse/0 linux-sparse/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-sparse linux-sparse/ https://lore.kernel.org/linux-sparse \
		linux-sparse@vger.kernel.org
	public-inbox-index linux-sparse

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-sparse


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git