Skip to content

Commit

Permalink
CRED: fix build error due to 'tgcred' undeclared
Browse files Browse the repository at this point in the history
This patch adds CONFIG_KEYS guard for tgcred to fix below build error
if CONFIG_KEYS is not configured.

  CC      kernel/cred.o
kernel/cred.c: In function 'prepare_kernel_cred':
kernel/cred.c:657: error: 'tgcred' undeclared (first use in this function)
kernel/cred.c:657: error: (Each undeclared identifier is reported only once
kernel/cred.c:657: error: for each function it appears in.)
make[1]: *** [kernel/cred.o] Error 1
make: *** [kernel] Error 2

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Axel Lin authored and James Morris committed Aug 23, 2011
1 parent 0c061b5 commit 8ad346c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,13 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)
if (!new)
return NULL;

#ifdef CONFIG_KEYS
tgcred = kmalloc(sizeof(*tgcred), GFP_KERNEL);
if (!tgcred) {
kmem_cache_free(cred_jar, new);
return NULL;
}
#endif

kdebug("prepare_kernel_cred() alloc %p", new);

Expand Down

0 comments on commit 8ad346c

Please sign in to comment.