From: Pavel Roskin <proski@gnu.org>
To: linux-kernel@vger.kernel.org,
"Yann E. MORIN" <yann.morin.1998@free.fr>,
linux-kbuild@vger.kernel.org
Subject: [PATCH] kconfig: fix warning in get_prompt_str()
Date: Mon, 01 Dec 2014 11:52:42 -0500 [thread overview]
Message-ID: <20141201165242.28180.22924.stgit@IRBT5387> (raw)
gcc 4.9.1 cannot figure out that jump would be initialized if both head
and location are not null. Initialize jump with NULL and check that it's
not NULL before using.
jump is not NULL at menu.c:590 if and only if head and location are not
NULL. Once jump is assigned a non-NULL value, head and location cannot go
from NULL to non-NULL or vice versa. It means that (jump != NULL) is
equal to (head && location != 0).
Thus remove checks for head and location. The intent of the check is to
ensure that jump is initialized, so make the code match its intent and
easier to read.
There should be no behavior change in get_prompt_str() regardless of the
input.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
| 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index a26cc5d..72c9dba 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
- struct jump_key *jump;
+ struct jump_key *jump = NULL;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
menu = prop->menu->parent;
@@ -586,7 +586,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
str_printf(r, _(" Location:\n"));
for (j = 4; --i >= 0; j += 2) {
menu = submenu[i];
- if (head && location && menu == location)
+ if (jump && menu == location)
jump->offset = strlen(r->s);
str_printf(r, "%*c-> %s", j, ' ',
_(menu_get_prompt(menu)));
reply other threads:[~2014-12-01 16:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141201165242.28180.22924.stgit@IRBT5387 \
--to=proski@gnu.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox