]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
KEYS: Use the variable 'key' in keyctl_describe_key()
authorDavid Howells <dhowells@redhat.com>
Mon, 28 Jun 2010 13:05:04 +0000 (14:05 +0100)
committerJames Morris <jmorris@namei.org>
Mon, 2 Aug 2010 05:34:56 +0000 (15:34 +1000)
keyctl_describe_key() turns the key reference it gets into a usable key pointer
and assigns that to a variable called 'key', which it then ignores in favour of
recomputing the key pointer each time it needs it.  Make it use the precomputed
pointer instead.

Without this patch, gcc 4.6 reports that the variable key is set but not used:

building with gcc 4.6 I'm getting a warning message:
 CC      security/keys/keyctl.o
security/keys/keyctl.c: In function 'keyctl_describe_key':
security/keys/keyctl.c:472:14: warning: variable 'key' set but not used

Reported-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/keys/keyctl.c

index 639226afd0db8feeae6886de7a44b46033e71ade..b2b0998d6abda7759433d7032d255eb0a317c126 100644 (file)
@@ -505,13 +505,11 @@ okay:
 
        ret = snprintf(tmpbuf, PAGE_SIZE - 1,
                       "%s;%d;%d;%08x;%s",
-                      key_ref_to_ptr(key_ref)->type->name,
-                      key_ref_to_ptr(key_ref)->uid,
-                      key_ref_to_ptr(key_ref)->gid,
-                      key_ref_to_ptr(key_ref)->perm,
-                      key_ref_to_ptr(key_ref)->description ?
-                      key_ref_to_ptr(key_ref)->description : ""
-                      );
+                      key->type->name,
+                      key->uid,
+                      key->gid,
+                      key->perm,
+                      key->description ?: "");
 
        /* include a NUL char at the end of the data */
        if (ret > PAGE_SIZE - 1)