Received: by 10.213.65.68 with SMTP id h4csp1222880imn; Wed, 14 Mar 2018 13:23:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELsMdNBaBCrByp8uhrxcRCZDKcTNexnY6oMV+xS+rvKQoqpO/wvUuVeyVcvErTtHDtnLmSZc X-Received: by 10.99.54.74 with SMTP id d71mr4643176pga.86.1521058980685; Wed, 14 Mar 2018 13:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521058980; cv=none; d=google.com; s=arc-20160816; b=fifnUoV7A5kUOGaugjMpWcyVjOeNq2U7jzGnvjIIxb7i7VnM8oWSStl66+lr3wCxlu xjsqz7scFkZtBzuknBOkZ8kgSrJ7C6mPHIpJ+to9pVD4NnQwbne92Y+VHdANpbSuLccI uuXLs37VeRAYv/Hn09LcFZizejezKVhS+R3GMp6dYwXmE5oA+QQedB7GKrv41PqN2kRV qquG74fRGCBOWTU9lxfC+X4MvJBLOYTJbd07g78nupCw5UqEIZNeyrgSYLM87YbkHY1r /lkhMQXtIP5QeEG2VdJ0XYugtLAuUgvwJMc4VEC+0Scc1e7bCYK5QsLkgXPoqA0y+7Q9 D73g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=bV0SlqMhEWn9I2D6g1XHEvPLhuh+6Jupny4LCEbNL/k=; b=F4nX/CGP+c7eRcDi0977As93KU22hwprVkKKVx0NawR+UkyzDRo2OwP+IOBmXHV9Zt wEaF1o7lp1z/DYLFLrFN/RS7vTlbp08a2XCZbf6Gl78UzNEy1NXpPJm1CGVMGf6xXF+7 WkEoQxwAaOKJ7onGLjteriBc9m853fLX8aK1eGAYiJyvoWBGWeeIGi+ctoE0kHm0I05z VjxD/pUO8xw1yD3ssd2vN1nvx+Bp3M3WRaIUgrsx3dTMcACCJ8fSuncQsRo1q+gMqXkl qzgHZFuOjM1LJ210ielm+L0Y8MBwyotALcOTE3JL+uvrTvTBNi3LZExhiSsk2e4YvvW+ xWDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66si2401571pgc.160.2018.03.14.13.22.46; Wed, 14 Mar 2018 13:23:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbeCNUV2 (ORCPT + 99 others); Wed, 14 Mar 2018 16:21:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58958 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbeCNUUo (ORCPT ); Wed, 14 Mar 2018 16:20:44 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EKKOZX014870 for ; Wed, 14 Mar 2018 16:20:44 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gqa9ygvqr-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 16:20:43 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 16:20:42 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 16:20:39 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EKKdXk49873130; Wed, 14 Mar 2018 20:20:39 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6C75AC03A; Wed, 14 Mar 2018 16:21:54 -0400 (EDT) Received: from morokweng.localdomain.com (unknown [9.85.137.56]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 145E2AC03F; Wed, 14 Mar 2018 16:21:52 -0400 (EDT) From: Thiago Jung Bauermann To: linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, James Morris , "Serge E. Hallyn" , Mimi Zohar , Dmitry Kasatkin , Thiago Jung Bauermann Subject: [PATCH 2/4] ima: Simplify ima_eventsig_init() Date: Wed, 14 Mar 2018 17:20:18 -0300 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180314202020.3794-1-bauerman@linux.vnet.ibm.com> References: <20180314202020.3794-1-bauerman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031420-0040-0000-0000-000004078E19 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008674; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01003063; UDB=6.00510447; IPR=6.00782393; MB=3.00020035; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-14 20:20:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031420-0041-0000-0000-000008088F16 Message-Id: <20180314202020.3794-3-bauerman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-14_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "goto out" statement doesn't have any purpose since there's no cleanup to be done when returning early, so remove it. This also makes the rc variable unnecessary so remove it as well. Also, the xattr_len and fmt variables are redundant so remove them as well. Signed-off-by: Thiago Jung Bauermann --- security/integrity/ima/ima_template_lib.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c index 28af43f63572..5afaa53decc5 100644 --- a/security/integrity/ima/ima_template_lib.c +++ b/security/integrity/ima/ima_template_lib.c @@ -378,16 +378,11 @@ int ima_eventname_ng_init(struct ima_event_data *event_data, int ima_eventsig_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { - enum data_formats fmt = DATA_FMT_HEX; struct evm_ima_xattr_data *xattr_value = event_data->xattr_value; - int xattr_len = event_data->xattr_len; - int rc = 0; if ((!xattr_value) || (xattr_value->type != EVM_IMA_XATTR_DIGSIG)) - goto out; + return 0; - rc = ima_write_template_field_data(xattr_value, xattr_len, fmt, - field_data); -out: - return rc; + return ima_write_template_field_data(xattr_value, event_data->xattr_len, + DATA_FMT_HEX, field_data); }