Skip to contentSkip to conversation

selinux: remove unneeded goto and its label

PATCH In review Kalevi Kolttonen 2 participants 2 messages Apr 30 – Jun 22 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: remove unneeded goto and its label

---
 security/selinux/avc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
security/selinux/avc.c +1 -2
index 813e82bcfc27..a9401d6c2e5f 100644
@@ -497,7 +497,7 @@ static struct avc_node *avc_alloc_node(void)
 
 	node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
 	if (!node)
-		goto out;
+		return NULL;
 
 	INIT_HLIST_NODE(&node->list);
 	avc_cache_stats_incr(allocations);
@@ -506,7 +506,6 @@ static struct avc_node *avc_alloc_node(void)
 	    selinux_avc.avc_cache_threshold)
 		avc_reclaim_node();
 
-out:
 	return node;
 }
 
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 2 lines · Kalevi Kolttonen

As with the other patch, it is typical to include some kind of description in the body, and
the subject line could be improved, e.g.
selinux: drop unnecessary goto and label from avc_alloc_node()

Since avc_alloc_node() doesn't need to perform any cleanup on its exit paths, there is no
benefit to keeping the out label and goto statement. Drop it.

Quoted 29 lines
---
 security/selinux/avc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
security/selinux/avc.c +1 -3
index 813e82bcfc27..a9401d6c2e5f 100644
@@ -497,7 +497,7 @@ static struct avc_node *avc_alloc_node(void)
 
        node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
        if (!node)
-               goto out;
+               return NULL;
 
        INIT_HLIST_NODE(&node->list);
        avc_cache_stats_incr(allocations);
@@ -506,7 +506,6 @@ static struct avc_node *avc_alloc_node(void)
            selinux_avc.avc_cache_threshold)
                avc_reclaim_node();
 
-out:
        return node;
 }
 
--

2.54.0