mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 23:52:40 +00:00
selinux: remove the unneeded result variable
Return the value avc_has_perm() directly instead of storing it in another redundant variable. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Xu Panda <xu.panda@zte.com.cn> [PM: subject line tweak] Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
parent
6354324d8a
commit
09b71adab0
1 changed files with 9 additions and 15 deletions
|
@ -5986,7 +5986,6 @@ static int selinux_msg_queue_alloc_security(struct kern_ipc_perm *msq)
|
||||||
struct ipc_security_struct *isec;
|
struct ipc_security_struct *isec;
|
||||||
struct common_audit_data ad;
|
struct common_audit_data ad;
|
||||||
u32 sid = current_sid();
|
u32 sid = current_sid();
|
||||||
int rc;
|
|
||||||
|
|
||||||
isec = selinux_ipc(msq);
|
isec = selinux_ipc(msq);
|
||||||
ipc_init_security(isec, SECCLASS_MSGQ);
|
ipc_init_security(isec, SECCLASS_MSGQ);
|
||||||
|
@ -5994,10 +5993,9 @@ static int selinux_msg_queue_alloc_security(struct kern_ipc_perm *msq)
|
||||||
ad.type = LSM_AUDIT_DATA_IPC;
|
ad.type = LSM_AUDIT_DATA_IPC;
|
||||||
ad.u.ipc_id = msq->key;
|
ad.u.ipc_id = msq->key;
|
||||||
|
|
||||||
rc = avc_has_perm(&selinux_state,
|
return avc_has_perm(&selinux_state,
|
||||||
sid, isec->sid, SECCLASS_MSGQ,
|
sid, isec->sid, SECCLASS_MSGQ,
|
||||||
MSGQ__CREATE, &ad);
|
MSGQ__CREATE, &ad);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int selinux_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg)
|
static int selinux_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg)
|
||||||
|
@ -6125,7 +6123,6 @@ static int selinux_shm_alloc_security(struct kern_ipc_perm *shp)
|
||||||
struct ipc_security_struct *isec;
|
struct ipc_security_struct *isec;
|
||||||
struct common_audit_data ad;
|
struct common_audit_data ad;
|
||||||
u32 sid = current_sid();
|
u32 sid = current_sid();
|
||||||
int rc;
|
|
||||||
|
|
||||||
isec = selinux_ipc(shp);
|
isec = selinux_ipc(shp);
|
||||||
ipc_init_security(isec, SECCLASS_SHM);
|
ipc_init_security(isec, SECCLASS_SHM);
|
||||||
|
@ -6133,10 +6130,9 @@ static int selinux_shm_alloc_security(struct kern_ipc_perm *shp)
|
||||||
ad.type = LSM_AUDIT_DATA_IPC;
|
ad.type = LSM_AUDIT_DATA_IPC;
|
||||||
ad.u.ipc_id = shp->key;
|
ad.u.ipc_id = shp->key;
|
||||||
|
|
||||||
rc = avc_has_perm(&selinux_state,
|
return avc_has_perm(&selinux_state,
|
||||||
sid, isec->sid, SECCLASS_SHM,
|
sid, isec->sid, SECCLASS_SHM,
|
||||||
SHM__CREATE, &ad);
|
SHM__CREATE, &ad);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int selinux_shm_associate(struct kern_ipc_perm *shp, int shmflg)
|
static int selinux_shm_associate(struct kern_ipc_perm *shp, int shmflg)
|
||||||
|
@ -6210,7 +6206,6 @@ static int selinux_sem_alloc_security(struct kern_ipc_perm *sma)
|
||||||
struct ipc_security_struct *isec;
|
struct ipc_security_struct *isec;
|
||||||
struct common_audit_data ad;
|
struct common_audit_data ad;
|
||||||
u32 sid = current_sid();
|
u32 sid = current_sid();
|
||||||
int rc;
|
|
||||||
|
|
||||||
isec = selinux_ipc(sma);
|
isec = selinux_ipc(sma);
|
||||||
ipc_init_security(isec, SECCLASS_SEM);
|
ipc_init_security(isec, SECCLASS_SEM);
|
||||||
|
@ -6218,10 +6213,9 @@ static int selinux_sem_alloc_security(struct kern_ipc_perm *sma)
|
||||||
ad.type = LSM_AUDIT_DATA_IPC;
|
ad.type = LSM_AUDIT_DATA_IPC;
|
||||||
ad.u.ipc_id = sma->key;
|
ad.u.ipc_id = sma->key;
|
||||||
|
|
||||||
rc = avc_has_perm(&selinux_state,
|
return avc_has_perm(&selinux_state,
|
||||||
sid, isec->sid, SECCLASS_SEM,
|
sid, isec->sid, SECCLASS_SEM,
|
||||||
SEM__CREATE, &ad);
|
SEM__CREATE, &ad);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int selinux_sem_associate(struct kern_ipc_perm *sma, int semflg)
|
static int selinux_sem_associate(struct kern_ipc_perm *sma, int semflg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue