diff mbox

SMACK: Delete list_head repeated initialization

Message ID 1479882528-32399-1-git-send-email-himanshu.sh@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Himanshu Shukla Nov. 23, 2016, 6:28 a.m. UTC
smk_copy_rules() and smk_copy_relabel() are initializing list_head though
they have been initialized already in new_task_smack() function. Delete
repeated initialization.

Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>
---
 security/smack/smack_lsm.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Casey Schaufler Nov. 28, 2016, 10:35 p.m. UTC | #1
On 11/22/2016 10:28 PM, Himanshu Shukla wrote:
> smk_copy_rules() and smk_copy_relabel() are initializing list_head though
> they have been initialized already in new_task_smack() function. Delete
> repeated initialization.
>
> Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>

Acked-by: Casey Schaufler <casey@schaufler-ca.com>

I have queued this for 4.11 as it's too late for 4.10.

> ---
>  security/smack/smack_lsm.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 1cb0602..f151a71 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -347,8 +347,6 @@ static int smk_copy_rules(struct list_head *nhead, struct list_head *ohead,
>  	struct smack_rule *orp;
>  	int rc = 0;
>  
> -	INIT_LIST_HEAD(nhead);
> -
>  	list_for_each_entry_rcu(orp, ohead, list) {
>  		nrp = kzalloc(sizeof(struct smack_rule), gfp);
>  		if (nrp == NULL) {
> @@ -375,8 +373,6 @@ static int smk_copy_relabel(struct list_head *nhead, struct list_head *ohead,
>  	struct smack_known_list_elem *nklep;
>  	struct smack_known_list_elem *oklep;
>  
> -	INIT_LIST_HEAD(nhead);
> -
>  	list_for_each_entry(oklep, ohead, list) {
>  		nklep = kzalloc(sizeof(struct smack_known_list_elem), gfp);
>  		if (nklep == NULL) {

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 1cb0602..f151a71 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -347,8 +347,6 @@  static int smk_copy_rules(struct list_head *nhead, struct list_head *ohead,
 	struct smack_rule *orp;
 	int rc = 0;
 
-	INIT_LIST_HEAD(nhead);
-
 	list_for_each_entry_rcu(orp, ohead, list) {
 		nrp = kzalloc(sizeof(struct smack_rule), gfp);
 		if (nrp == NULL) {
@@ -375,8 +373,6 @@  static int smk_copy_relabel(struct list_head *nhead, struct list_head *ohead,
 	struct smack_known_list_elem *nklep;
 	struct smack_known_list_elem *oklep;
 
-	INIT_LIST_HEAD(nhead);
-
 	list_for_each_entry(oklep, ohead, list) {
 		nklep = kzalloc(sizeof(struct smack_known_list_elem), gfp);
 		if (nklep == NULL) {