Commit 94fd8405 authored by David Howells's avatar David Howells Committed by James Morris

KEYS: Use the variable 'key' in keyctl_describe_key()

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: default avatarJustin P. Mattock <justinmattock@gmail.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 0849e3ba
...@@ -505,13 +505,11 @@ long keyctl_describe_key(key_serial_t keyid, ...@@ -505,13 +505,11 @@ long keyctl_describe_key(key_serial_t keyid,
ret = snprintf(tmpbuf, PAGE_SIZE - 1, ret = snprintf(tmpbuf, PAGE_SIZE - 1,
"%s;%d;%d;%08x;%s", "%s;%d;%d;%08x;%s",
key_ref_to_ptr(key_ref)->type->name, key->type->name,
key_ref_to_ptr(key_ref)->uid, key->uid,
key_ref_to_ptr(key_ref)->gid, key->gid,
key_ref_to_ptr(key_ref)->perm, key->perm,
key_ref_to_ptr(key_ref)->description ? key->description ?: "");
key_ref_to_ptr(key_ref)->description : ""
);
/* include a NUL char at the end of the data */ /* include a NUL char at the end of the data */
if (ret > PAGE_SIZE - 1) if (ret > PAGE_SIZE - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment