Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Xu Panda and committed by
Paul Moore
09b71ada 6354324d

+9 -15
+9 -15
security/selinux/hooks.c
··· 5986 5986 struct ipc_security_struct *isec; 5987 5987 struct common_audit_data ad; 5988 5988 u32 sid = current_sid(); 5989 - int rc; 5990 5989 5991 5990 isec = selinux_ipc(msq); 5992 5991 ipc_init_security(isec, SECCLASS_MSGQ); ··· 5993 5994 ad.type = LSM_AUDIT_DATA_IPC; 5994 5995 ad.u.ipc_id = msq->key; 5995 5996 5996 - rc = avc_has_perm(&selinux_state, 5997 - sid, isec->sid, SECCLASS_MSGQ, 5998 - MSGQ__CREATE, &ad); 5999 - return rc; 5997 + return avc_has_perm(&selinux_state, 5998 + sid, isec->sid, SECCLASS_MSGQ, 5999 + MSGQ__CREATE, &ad); 6000 6000 } 6001 6001 6002 6002 static int selinux_msg_queue_associate(struct kern_ipc_perm *msq, int msqflg) ··· 6123 6125 struct ipc_security_struct *isec; 6124 6126 struct common_audit_data ad; 6125 6127 u32 sid = current_sid(); 6126 - int rc; 6127 6128 6128 6129 isec = selinux_ipc(shp); 6129 6130 ipc_init_security(isec, SECCLASS_SHM); ··· 6130 6133 ad.type = LSM_AUDIT_DATA_IPC; 6131 6134 ad.u.ipc_id = shp->key; 6132 6135 6133 - rc = avc_has_perm(&selinux_state, 6134 - sid, isec->sid, SECCLASS_SHM, 6135 - SHM__CREATE, &ad); 6136 - return rc; 6136 + return avc_has_perm(&selinux_state, 6137 + sid, isec->sid, SECCLASS_SHM, 6138 + SHM__CREATE, &ad); 6137 6139 } 6138 6140 6139 6141 static int selinux_shm_associate(struct kern_ipc_perm *shp, int shmflg) ··· 6206 6210 struct ipc_security_struct *isec; 6207 6211 struct common_audit_data ad; 6208 6212 u32 sid = current_sid(); 6209 - int rc; 6210 6213 6211 6214 isec = selinux_ipc(sma); 6212 6215 ipc_init_security(isec, SECCLASS_SEM); ··· 6213 6218 ad.type = LSM_AUDIT_DATA_IPC; 6214 6219 ad.u.ipc_id = sma->key; 6215 6220 6216 - rc = avc_has_perm(&selinux_state, 6217 - sid, isec->sid, SECCLASS_SEM, 6218 - SEM__CREATE, &ad); 6219 - return rc; 6221 + return avc_has_perm(&selinux_state, 6222 + sid, isec->sid, SECCLASS_SEM, 6223 + SEM__CREATE, &ad); 6220 6224 } 6221 6225 6222 6226 static int selinux_sem_associate(struct kern_ipc_perm *sma, int semflg)