mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: dhowells@redhat.com, James Morris <jmorris@namei.org>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [GIT] Security changes for 2.6.29
Date: Mon, 29 Dec 2008 00:41:51 +0000	[thread overview]
Message-ID: <7921.1230511311@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0812281232350.3057@localhost.localdomain>


Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Yes, it's possible that this is just a bogus warning, with gcc-4.3.2 for
> x86-64, but please fix it.

Does this fix the warning?  My compiler doesn't show it; of course, I'm not
using gcc-4.3.2, but something older.

David
---
KEYS: Fix variable uninitialisation warnings

From: David Howells <dhowells@redhat.com>

Fix variable uninitialisation warnings introduced in:

	commit 8bbf4976b59fc9fc2861e79cab7beb3f6d647640
	Author: David Howells <dhowells@redhat.com>
	Date:   Fri Nov 14 10:39:14 2008 +1100

	KEYS: Alter use of key instantiation link-to-keyring argument

As:

  security/keys/keyctl.c: In function 'keyctl_negate_key':
  security/keys/keyctl.c:976: warning: 'dest_keyring' may be used uninitialized in this function
  security/keys/keyctl.c: In function 'keyctl_instantiate_key':
  security/keys/keyctl.c:898: warning: 'dest_keyring' may be used uninitialized in this function

Some versions of gcc notice that get_instantiation_key() doesn't always set
*_dest_keyring, but fail to observe that if this happens then *_dest_keyring
will not be read by the caller.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 security/keys/keyctl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 7c72baa..6688765 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -838,11 +838,11 @@ static long get_instantiation_keyring(key_serial_t ringid,
 {
 	key_ref_t dkref;
 
+	*_dest_keyring = NULL;
+
 	/* just return a NULL pointer if we weren't asked to make a link */
-	if (ringid == 0) {
-		*_dest_keyring = NULL;
+	if (ringid == 0)
 		return 0;
-	}
 
 	/* if a specific keyring is nominated by ID, then use that */
 	if (ringid > 0) {

  parent reply	other threads:[~2008-12-29  0:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-25  1:07 James Morris
2008-12-28 20:32 ` Linus Torvalds
2008-12-29  0:41 ` David Howells [this message]
2008-12-29  0:53   ` Linus Torvalds
2008-12-29  3:30     ` James Morris

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=7921.1230511311@redhat.com \
    --to=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®