lkml.org 
[lkml]   [2020]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] selinux: remove redundant msg_msg_alloc_security
From
Date
On 1/10/20 4:58 AM, Huaisheng Ye wrote:
> From: Huaisheng Ye <yehs1@lenovo.com>
>
> selinux_msg_msg_alloc_security only calls msg_msg_alloc_security but
> do nothing else. And also msg_msg_alloc_security is just used by the
> former.
>
> Remove the redundant function to simplify the code.

This seems to also be true of other _alloc_security functions, probably
due to historical reasons. Further, at least some of these functions no
longer perform any allocation; they are just initialization functions
now that allocation has been taken to the LSM framework, so possibly
could be renamed and made to return void at some point.

>
> Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
> security/selinux/hooks.c | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 9625b99..fb1b9da 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -5882,16 +5882,6 @@ static void ipc_init_security(struct ipc_security_struct *isec, u16 sclass)
> isec->sid = current_sid();
> }
>
> -static int msg_msg_alloc_security(struct msg_msg *msg)
> -{
> - struct msg_security_struct *msec;
> -
> - msec = selinux_msg_msg(msg);
> - msec->sid = SECINITSID_UNLABELED;
> -
> - return 0;
> -}
> -
> static int ipc_has_perm(struct kern_ipc_perm *ipc_perms,
> u32 perms)
> {
> @@ -5910,7 +5900,12 @@ static int ipc_has_perm(struct kern_ipc_perm *ipc_perms,
>
> static int selinux_msg_msg_alloc_security(struct msg_msg *msg)
> {
> - return msg_msg_alloc_security(msg);
> + struct msg_security_struct *msec;
> +
> + msec = selinux_msg_msg(msg);
> + msec->sid = SECINITSID_UNLABELED;
> +
> + return 0;
> }
>
> /* message queue security operations */
>

\
 
 \ /
  Last update: 2020-01-10 16:13    [W:0.757 / U:1.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site