lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 03 Sep 2014 09:00:16 -0400
From:	Mimi Zohar <zohar@...ux.vnet.ibm.com>
To:	Dmitry Kasatkin <d.kasatkin@...sung.com>
Cc:	linux-ima-devel@...ts.sourceforge.net,
	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org, dmitry.kasatkin@...il.com
Subject: Re: [PATCH 3/8] ima: simplify conditional statement to improve
 performance

On Wed, 2014-09-03 at 10:19 +0300, Dmitry Kasatkin wrote: 
> Precede bit testing before string comparison makes code
> faster. Also refactor statement as a single line pointer
> assignment.
> 
> Signed-off-by: Dmitry Kasatkin <d.kasatkin@...sung.com>

Functionally the code hasn't change, but the resulting conditional
statement isn't as clear, at least to me, as the original code.  Please
include here in the patch description a short explanation of what the
code is doing.

thanks,

Mimi

> ---
>  security/integrity/ima/ima_main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index f82cf9b..f7b85bf 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -206,10 +206,8 @@ static int process_measurement(struct file *file, const char *filename,
>  	}
> 
>  	template_desc = ima_template_desc_current();
> -	if (strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) == 0) {
> -		if (action & IMA_APPRAISE_SUBMASK)
> -			xattr_ptr = &xattr_value;
> -	} else
> +	if ((action & IMA_APPRAISE_SUBMASK) ||
> +		    strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) != 0)
>  		xattr_ptr = &xattr_value;
> 
>  	rc = ima_collect_measurement(iint, file, xattr_ptr, &xattr_len);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ