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] [day] [month] [year] [list]
Date:	Tue, 21 Jul 2009 18:33:45 GMT
From:	tip-bot for Jan Beulich <JBeulich@...ell.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	andi@...stfloor.org, jbeulich@...ell.com, JBeulich@...ell.com,
	tglx@...utronix.de
Subject: [tip:x86/urgent] x86, mce: Fix set_trigger() accessor

Commit-ID:  e9084ec98bb9aa3abc6cf73181177780ce7546f8
Gitweb:     http://git.kernel.org/tip/e9084ec98bb9aa3abc6cf73181177780ce7546f8
Author:     Jan Beulich <JBeulich@...ell.com>
AuthorDate: Thu, 16 Jul 2009 09:45:11 +0100
Committer:  H. Peter Anvin <hpa@...or.com>
CommitDate: Tue, 21 Jul 2009 10:49:18 -0700

x86, mce: Fix set_trigger() accessor

Fix the condition checking the result of strchr() (which previously
could result in an oops), and make the function return the number of
bytes actively used.

[ Impact: fix oops ]

Signed-off-by: Jan Beulich <jbeulich@...ell.com>
Cc: Andi Kleen <andi@...stfloor.org>
LKML-Reference: <4A5F04B7020000780000AB59@....id2.novell.com>
Signed-off-by: H. Peter Anvin <hpa@...or.com>


---
 arch/x86/kernel/cpu/mcheck/mce.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 484c1e5..1cfb623 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1692,17 +1692,15 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
 				const char *buf, size_t siz)
 {
 	char *p;
-	int len;
 
 	strncpy(mce_helper, buf, sizeof(mce_helper));
 	mce_helper[sizeof(mce_helper)-1] = 0;
-	len = strlen(mce_helper);
 	p = strchr(mce_helper, '\n');
 
-	if (*p)
+	if (p)
 		*p = 0;
 
-	return len;
+	return strlen(mce_helper) + !!p;
 }
 
 static ssize_t set_ignore_ce(struct sys_device *s,
--
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