Received: by 10.213.65.68 with SMTP id h4csp1256513imn; Wed, 14 Mar 2018 14:34:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELtiSUaq8sX9xC+e96Tzz2L33IWzAFMC2Jk3fHhs0+F98uV4HvvAfJYJDQBgUbQ/7PAddwVN X-Received: by 10.98.65.72 with SMTP id o69mr5578137pfa.97.1521063251731; Wed, 14 Mar 2018 14:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521063251; cv=none; d=google.com; s=arc-20160816; b=s490FfKo/hHI1nhY9fVTf5CTHmCOAPjG7wi02WVNkepkAp+Txal/+DznCUDEY2p4tW sd8/nlpydZ4x68Q2jIeY7iWKS9rt1lfj/Qu2yh1x2zkyOdx65NY9tSuizUDfFlosRyAc xu2yMS2EHfcbIKzLl0Eqv0+My6SiVNMrxPGwEZFZlDh7rtGmr3GwB6Y3Z5A49GnfuNIG WV1yGA6YBX/JP1PzstbUWbEuDlB6WWqMUfx1JUdEYEZmZZ738PEOWHTDgiUJXxoS3F3y SMbiaok9dqE9wFxj4ujYl7yYNMqdexQHD2DXU+FgleJDFLfp0hhiJprh1PkYXHxo1m7g LoYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ZJi1kMA9Vdzp0m80lg6z4XAPGb05/vClun76SOLRFOw=; b=LKTWMWKMeXBlG6skiLMk7cAsUdzgaSpaza3+pd3azfAO81bmoRWouhwTchKddla0q9 zXOUs8E85mlXq+kCXi+oOYIuH9uTFzh6HAONECbZmH+d8+ZoHMFtpx9CaJIzvtAkBR1S 3bO2VoFcwXP5xOidQRxX6WjXNVA5xxFCgqVvaAE+Zp4smIQXCqAa/ummbRfICivCRP7F 7cuOdxtKhX91cwKGCyzTptxrpY8WMaiEgLiNcHbg7QNENZVMFwybhxvj2GYQNDdNqJai r+V1Sg8KzCU8ukkrX9WQPUuPYUQ8Svcx4Ad4X96bzHiVX8QdExpaCOIw7Kn86oAo9ZjQ F/fQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si2386778pga.382.2018.03.14.14.33.57; Wed, 14 Mar 2018 14:34:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbeCNVbs (ORCPT + 99 others); Wed, 14 Mar 2018 17:31:48 -0400 Received: from h2.hallyn.com ([78.46.35.8]:45028 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeCNVbg (ORCPT ); Wed, 14 Mar 2018 17:31:36 -0400 Received: by mail.hallyn.com (Postfix, from userid 1001) id D238A120C2E; Wed, 14 Mar 2018 16:31:34 -0500 (CDT) Date: Wed, 14 Mar 2018 16:31:34 -0500 From: "Serge E. Hallyn" To: Thiago Jung Bauermann Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, James Morris , "Serge E. Hallyn" , Mimi Zohar , Dmitry Kasatkin Subject: Re: [PATCH 2/4] ima: Simplify ima_eventsig_init() Message-ID: <20180314213134.GA14289@mail.hallyn.com> References: <20180314202020.3794-1-bauerman@linux.vnet.ibm.com> <20180314202020.3794-3-bauerman@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180314202020.3794-3-bauerman@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Thiago Jung Bauermann (bauerman@linux.vnet.ibm.com): > 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 Acked-by: Serge Hallyn > --- > 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); > }