[PATCH 1/5]security:key.c Fix warning: variable 'key' set but not used

From: Justin P. Mattock
Date: Sun Jun 27 2010 - 02:48:01 EST

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

After reading key.h I noticed it says this:
NOTE! key_ref_t is a typedef'd pointer to a type that is not actually
defined. This is because we abuse the bottom bit of the reference to carry a
flag to indicate whether the calling process possesses that key in one of
its keyrings.

In this case the safest approach(in my mind) would be to just
mark the integer __unused. Keep in mind though Im not certain
if this is the right place for this value i.e. will this effect
*instkey or not(please check).

Signed-off-by: Justin P. Mattock <justinmattock@xxxxxxxxx>

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

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 13074b4..d7bb74f 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -469,7 +469,7 @@ long keyctl_describe_key(key_serial_t keyid,
char __user *buffer,
size_t buflen)
- struct key *key, *instkey;
+ struct key *key __attribute__((unused)), *instkey;
key_ref_t key_ref;
char *tmpbuf;
long ret;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/