From patchwork Wed Nov 23 06:28:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Shukla X-Patchwork-Id: 9442657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CCAB60778 for ; Wed, 23 Nov 2016 06:46:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C18720649 for ; Wed, 23 Nov 2016 06:46:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CECD2094F; Wed, 23 Nov 2016 06:46:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4499B20649 for ; Wed, 23 Nov 2016 06:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932618AbcKWGoR (ORCPT ); Wed, 23 Nov 2016 01:44:17 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:59980 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932484AbcKWGoR (ORCPT ); Wed, 23 Nov 2016 01:44:17 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OH3035YX0VB1XA0@mailout1.samsung.com> for linux-security-module@vger.kernel.org; Wed, 23 Nov 2016 15:33:13 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-0a-583538292489 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id E9.22.25310.92835385; Wed, 23 Nov 2016 15:33:13 +0900 (KST) Received: from localhost.localdomain ([107.108.92.210]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OH300LF50V7G220@mmp2.samsung.com>; Wed, 23 Nov 2016 15:33:13 +0900 (KST) From: Himanshu Shukla To: casey@schaufler-ca.com, linux-security-module@vger.kernel.org Cc: himanshu.sh@samsung.com, vishal.goel@samsung.com Subject: [PATCH] SMACK: Delete list_head repeated initialization Date: Wed, 23 Nov 2016 11:58:48 +0530 Message-id: <1479882528-32399-1-git-send-email-himanshu.sh@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFLMWRmVeSWpSXmKPExsVy+t9jQV1NC9MIg6U/tS3ubfvFZrH3SQur xYeeR2wW626fZnRg8ejbsorR4+j+RWwenzfJBTBHudlkpCampBYppOYl56dk5qXbKoWGuOla KCnkJeam2ipF6PqGBCkplCXmlAJ5RgZowME5wD1YSd8uwS2j+dxu5oI3HBVrHx5mamDcwt7F yMkhIWAi8eXARyYIW0ziwr31bF2MXBxCArMYJf4/3gPl/GSUeHL0NFgHm4C+REvHJDYQW0TA UaLx1HKwbmagSXe3n2HsYuTgEBZwkNjyzQ4kzCKgKnH/3TUWkDCvgLvEj0m6ELvkJE4em8w6 gZF7ASPDKkaJ1ILkguKk9FzDvNRyveLE3OLSvHS95PzcTYzgcHsmtYPx4C73Q4wCHIxKPLwC ISYRQqyJZcWVuYcYJTiYlUR4r5qaRgjxpiRWVqUW5ccXleakFh9iNAXaP5FZSjQ5HxgLeSXx hibmJubGBhbmlpYmRkrivI2zn4ULCaQnlqRmp6YWpBbB9DFxcEo1MM4OTX761Ew0P+fQpGzB pgWy+1Z8u/yZ9yTz8wUmSx4suXL29c6mAPeGE/mHNm1PciurjexqanrP/YvNitvt+icm3gNX n8+b9Cdbf2mAgYuGQOEL3lWrpJZfyks5GKOyWV8uQFW3LUE0u9z86PtHto84ebb3dj74c7Hj 7onjwpcvW9xl+tR3NEuJpTgj0VCLuag4EQA/eTtBTQIAAA== X-MTR: 20000000000000000@CPGS Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Casey Schaufler --- 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) {