]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
KEYS: Fix variable uninitialisation warnings
authorDavid Howells <dhowells@redhat.com>
Mon, 29 Dec 2008 00:41:51 +0000 (00:41 +0000)
committerJames Morris <jmorris@namei.org>
Mon, 29 Dec 2008 03:24:43 +0000 (14:24 +1100)
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>
Signed-off-by: James Morris <jmorris@namei.org>
security/keys/keyctl.c

index 7c72baa02f2e93ff09c76be260201da3315e32e5..6688765bd8b96fcf927db7590a7e1fb5ab3bed1a 100644 (file)
@@ -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) {