Эх сурвалжийг харах

selinux: Return directly after a failed kzalloc() in roles_init()

Return directly after a call of the function "kzalloc" failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Markus Elfring 8 жил өмнө
parent
commit
ebd2b47ba5

+ 1 - 2
security/selinux/ss/policydb.c

@@ -178,10 +178,9 @@ static int roles_init(struct policydb *p)
 	int rc;
 	int rc;
 	struct role_datum *role;
 	struct role_datum *role;
 
 
-	rc = -ENOMEM;
 	role = kzalloc(sizeof(*role), GFP_KERNEL);
 	role = kzalloc(sizeof(*role), GFP_KERNEL);
 	if (!role)
 	if (!role)
-		goto out;
+		return -ENOMEM;
 
 
 	rc = -EINVAL;
 	rc = -EINVAL;
 	role->value = ++p->p_roles.nprim;
 	role->value = ++p->p_roles.nprim;