mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Mimi Zohar <zohar@us.ibm.com>,
	Dmitry Kasatkin <d.kasatkin@samsung.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	James Morris <james.l.morris@oracle.com>
Subject: [PATCH] ima: Fix build failure of redefinition of integrity_init_keyring()
Date: Tue, 26 Nov 2013 15:04:15 -0500	[thread overview]
Message-ID: <20131126150415.2ecdb563@gandalf.local.home> (raw)

If CONFIG_INTEGRITY_SIGNATURE is set, but
CONFIG_INTEGRITY_ASYMMETRIC_KEYS is not, then we get the following
build failure:

linux.git/security/integrity/digsig.c:70:5: error: redefinition of ‘integrity_init_keyring’
linux.git/security/integrity/integrity.h:149:12: note: previous definition of ‘integrity_init_keyring’ was here
linux.git/security/integrity/integrity.h:149:12: warning: ‘integrity_init_keyring’ defined but not used distcc[8580] ERROR:
compile /home/rostedt/work/git/linux-trace.git/security/integrity/digsig.c on localhost failed

The problem is that CONFIG_INTEGRITY_SIGNATURE will compile digsig.o,
which defines integrity_init_keyring(), but when
CONFIG_INTEGRITY_ASYMMETRIC_KEYS is not defined, the header will define
integrity_init_keyring() as a static inline.

Do not define integrity_init_keyring() when
CONFIG_INTEGRITY_ASYMMETRIC_KEYS is not configured.

I also added the missing "inline" for the stub function.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c
index 77ca965..00bc3e1 100644
--- a/security/integrity/digsig.c
+++ b/security/integrity/digsig.c
@@ -67,6 +67,7 @@ int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
 	return -EOPNOTSUPP;
 }
 
+#ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS
 int integrity_init_keyring(const unsigned int id)
 {
 	const struct cred *cred = current_cred();
@@ -84,3 +85,4 @@ int integrity_init_keyring(const unsigned int id)
 			keyring_name[id], PTR_ERR(keyring[id]));
 	return 0;
 }
+#endif
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h
index b9e7c13..c3d48dc 100644
--- a/security/integrity/integrity.h
+++ b/security/integrity/integrity.h
@@ -146,7 +146,7 @@ static inline int asymmetric_verify(struct key *keyring, const char *sig,
 	return -EOPNOTSUPP;
 }
 
-static int integrity_init_keyring(const unsigned int id)
+static inline int integrity_init_keyring(const unsigned int id)
 {
 	return 0;
 }

             reply	other threads:[~2013-11-26 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 20:04 Steven Rostedt [this message]
2013-11-26 20:12 ` Linus Torvalds
2013-11-26 20:23   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131126150415.2ecdb563@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=d.kasatkin@samsung.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zohar@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®