From: Stephen Smalley on
On Fri, 2010-02-19 at 19:40 +0800, wzt wzt wrote:
> I rewrite the patch, thx.

Patch description needs to be descriptive, e.g.:
"Enhance the security framework to support resetting the active security
module. This eliminates the need for direct use of the security_ops
variable outside of security.c, so make security_ops static."

Subject line could be more descriptive too, and likely just use
security: as the prefix.

You also need a Signed-off-by line, with a real name.

Also, see the comments below.

> ---
> include/linux/security.h | 2 ++
> security/security.c | 7 ++++++-
> security/selinux/hooks.c | 14 ++------------
> 3 files changed, 10 insertions(+), 13 deletions(-)
>

> diff --git a/security/security.c b/security/security.c
> index 122b748..3e4c4bc 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -26,7 +26,7 @@ static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
> extern struct security_operations default_security_ops;
> extern void security_fixup_ops(struct security_operations *ops);
>
> -struct security_operations *security_ops; /* Initialized to NULL */
> +static struct security_operations *security_ops; /* Initialized
> to NULL */

You can drop the /* Initialized to NULL */ comment since it is now
static.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 9a2ee84..e9599fd 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -93,6 +93,7 @@
>
> extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
> extern struct security_operations *security_ops;
> +extern struct security_operations default_security_ops;

We don't need this extern declaration.

The next obvious cleanup would be to make default_security_ops static.
That will require some code reorganization though - it is presently
defined in capability.c and manipulated by security.c.

--
Stephen Smalley
National Security Agency

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