Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1743059 > unrolled thread

[PATCH 0/2] RAS: two fixlets

Started byBorislav Petkov <bp@alien8.de>
First post2017-10-02 11:30 +0200
Last post2017-10-02 11:30 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] RAS: two fixlets Borislav Petkov <bp@alien8.de> - 2017-10-02 11:30 +0200
    [PATCH 1/2] RAS/CEC: Use the right length for "cec_disable" Borislav Petkov <bp@alien8.de> - 2017-10-02 11:30 +0200
      Re: [PATCH 1/2] RAS/CEC: Use the right length for "cec_disable" Thomas Gleixner <tglx@linutronix.de> - 2017-10-02 22:50 +0200
    [PATCH 2/2] x86/mce: Hide mca_cfg Borislav Petkov <bp@alien8.de> - 2017-10-02 11:30 +0200

#1743059 — [PATCH 0/2] RAS: two fixlets

FromBorislav Petkov <bp@alien8.de>
Date2017-10-02 11:30 +0200
Subject[PATCH 0/2] RAS: two fixlets
Message-ID<uw5cZ-5yk-5@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

Hi guys,

just minor stuff right now. Please queue.

Thx.

Borislav Petkov (1):
  x86/mce: Hide mca_cfg

Nicolas Iooss (1):
  RAS/CEC: Use the right length for "cec_disable"

 arch/x86/include/asm/mce.h                | 1 -
 arch/x86/kernel/cpu/mcheck/mce-internal.h | 7 +++++++
 arch/x86/kernel/cpu/mcheck/mce_amd.c      | 2 ++
 drivers/ras/cec.c                         | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.13.0

[toc] | [next] | [standalone]


#1743061 — [PATCH 1/2] RAS/CEC: Use the right length for "cec_disable"

FromBorislav Petkov <bp@alien8.de>
Date2017-10-02 11:30 +0200
Subject[PATCH 1/2] RAS/CEC: Use the right length for "cec_disable"
Message-ID<uw5d0-5yk-21@gated-at.bofh.it>
In reply to#1743059
From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

parse_cec_param() compares a string with "cec_disable" using only 7
characters of the 11-character-long string. Fix the length.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
Link: http://lkml.kernel.org/r/20170903075440.30250-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 drivers/ras/cec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index d0e5d6ee882c..586c296d1538 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -523,7 +523,7 @@ int __init parse_cec_param(char *str)
 	if (*str == '=')
 		str++;
 
-	if (!strncmp(str, "cec_disable", 7))
+	if (!strncmp(str, "cec_disable", 11))
 		ce_arr.disabled = 1;
 	else
 		return 0;
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1743314 — Re: [PATCH 1/2] RAS/CEC: Use the right length for "cec_disable"

FromThomas Gleixner <tglx@linutronix.de>
Date2017-10-02 22:50 +0200
SubjectRe: [PATCH 1/2] RAS/CEC: Use the right length for "cec_disable"
Message-ID<uwfPj-ur-275@gated-at.bofh.it>
In reply to#1743061
On Mon, 2 Oct 2017, Borislav Petkov wrote:
> From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> 
> parse_cec_param() compares a string with "cec_disable" using only 7
> characters of the 11-character-long string. Fix the length.
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> Fixes: 011d82611172 ("RAS: Add a Corrected Errors Collector")
> Link: http://lkml.kernel.org/r/20170903075440.30250-1-nicolas.iooss_linux@m4x.org
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  drivers/ras/cec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
> index d0e5d6ee882c..586c296d1538 100644
> --- a/drivers/ras/cec.c
> +++ b/drivers/ras/cec.c
> @@ -523,7 +523,7 @@ int __init parse_cec_param(char *str)
>  	if (*str == '=')
>  		str++;
>  
> -	if (!strncmp(str, "cec_disable", 7))
> +	if (!strncmp(str, "cec_disable", 11))

This kind of issue happens over and over. So if you really want to use
strncmp() then this should be:

#define	CEC_DISABLE	"cec_disable"

	if (!strncmp(str, CEC_DISABLE, strlen(CEC_DISABLE))

or we get a proper helper for that. Though in case of comparing some string
against a constant string strncmp() has no real advantage over strcmp() as
the comparison is guaranteed to be bound by the string constant.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1743062 — [PATCH 2/2] x86/mce: Hide mca_cfg

FromBorislav Petkov <bp@alien8.de>
Date2017-10-02 11:30 +0200
Subject[PATCH 2/2] x86/mce: Hide mca_cfg
Message-ID<uw5d0-5yk-23@gated-at.bofh.it>
In reply to#1743059
From: Borislav Petkov <bp@suse.de>

Now that lguest is gone, put it in the internal header which should be
used only by MCA/RAS code.

Add missing header guards while at it.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/include/asm/mce.h                | 1 -
 arch/x86/kernel/cpu/mcheck/mce-internal.h | 7 +++++++
 arch/x86/kernel/cpu/mcheck/mce_amd.c      | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 181264989db5..8edac1de2e35 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -187,7 +187,6 @@ struct mca_msr_regs {
 
 extern struct mce_vendor_flags mce_flags;
 
-extern struct mca_config mca_cfg;
 extern struct mca_msr_regs msr_ops;
 
 enum mce_notifier_prios {
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 098530a93bb7..debb974fd17d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -1,3 +1,6 @@
+#ifndef __X86_MCE_INTERNAL_H__
+#define __X86_MCE_INTERNAL_H__
+
 #include <linux/device.h>
 #include <asm/mce.h>
 
@@ -108,3 +111,7 @@ static inline void mce_work_trigger(void)	{ }
 static inline void mce_register_injector_chain(struct notifier_block *nb)	{ }
 static inline void mce_unregister_injector_chain(struct notifier_block *nb)	{ }
 #endif
+
+extern struct mca_config mca_cfg;
+
+#endif /* __X86_MCE_INTERNAL_H__ */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 40e28ed77fbf..486f640b02ef 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -28,6 +28,8 @@
 #include <asm/msr.h>
 #include <asm/trace/irq_vectors.h>
 
+#include "mce-internal.h"
+
 #define NR_BLOCKS         5
 #define THRESHOLD_MAX     0xFFF
 #define INT_TYPE_APIC     0x00020000
-- 
2.13.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web