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-next>] [day] [month] [year] [list]
Message-ID: <1426584684-187152-1-git-send-email-long.wanglong@huawei.com>
Date:	Tue, 17 Mar 2015 09:31:24 +0000
From:	Wang Long <long.wanglong@...wei.com>
To:	<anton@...msg.org>, <ccross@...roid.com>, <keescook@...omium.org>,
	<tony.luck@...el.com>
CC:	<linux-kernel@...r.kernel.org>, <long.wanglong@...wei.com>,
	<peifeiyue@...wei.com>, <marco.stornelli@...il.com>,
	<anton.vorontsov@...aro.org>, <salyzyn@...roid.com>,
	<sergiu@...omium.org>
Subject: [PATCH] fs/pstore: Optimization function ramoops_init_przs

The value of cxt->record_size does not change in the loop,
so this patch optimize the assign statement by moving
it to outer.

Signed-off-by: Wang Long <long.wanglong@...wei.com>
---
 fs/pstore/ram.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 44a549b..2105a16 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -373,6 +373,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 {
 	int err = -ENOMEM;
 	int i;
+	size_t sz;
 
 	if (!cxt->record_size)
 		return 0;
@@ -393,9 +394,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 		goto fail_prz;
 	}
 
+	sz = cxt->record_size;
 	for (i = 0; i < cxt->max_dump_cnt; i++) {
-		size_t sz = cxt->record_size;
-
 		cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
 						  &cxt->ecc_info,
 						  cxt->memtype);
-- 
1.8.3.4

--
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