aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2012-09-10 10:50:54 -0400
committerBorislav Petkov <bp@alien8.de>2012-11-28 05:23:32 -0500
commit37929874d439d79e8f6128f400f63069ee1bbf3e (patch)
treeb0f8ac80ab7b804a03a47a0bb1457dfe2a39effc /drivers/edac
parent876bb331e26b970c2d8caea2c1d1209fdae953d0 (diff)
EDAC: Boundary-check edac_debug_level
Only levels [0:4] are allowed so enforce that. Also, while at it, massage Kconfig text and add valid debug levels range to the module parameter description. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/Kconfig8
-rw-r--r--drivers/edac/edac_module.c27
2 files changed, 24 insertions, 11 deletions
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 409b92b8d346..bb82d6be793c 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -42,10 +42,10 @@ config EDAC_LEGACY_SYSFS
42config EDAC_DEBUG 42config EDAC_DEBUG
43 bool "Debugging" 43 bool "Debugging"
44 help 44 help
45 This turns on debugging information for the entire EDAC 45 This turns on debugging information for the entire EDAC subsystem.
46 sub-system. You can insert module with "debug_level=x", current 46 You do so by inserting edac_module with "edac_debug_level=x." Valid
47 there're four debug levels (x=0,1,2,3 from low to high). 47 levels are 0-4 (from low to high) and by default it is set to 2.
48 Usually you should select 'N'. 48 Usually you should select 'N' here.
49 49
50config EDAC_DECODE_MCE 50config EDAC_DECODE_MCE
51 tristate "Decode MCEs in human-readable form (only on AMD for now)" 51 tristate "Decode MCEs in human-readable form (only on AMD for now)"
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 58a28d838f37..12c951a2c33d 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -18,9 +18,29 @@
18#define EDAC_VERSION "Ver: 3.0.0" 18#define EDAC_VERSION "Ver: 3.0.0"
19 19
20#ifdef CONFIG_EDAC_DEBUG 20#ifdef CONFIG_EDAC_DEBUG
21
22static int edac_set_debug_level(const char *buf, struct kernel_param *kp)
23{
24 unsigned long val;
25 int ret;
26
27 ret = kstrtoul(buf, 0, &val);
28 if (ret)
29 return ret;
30
31 if (val < 0 || val > 4)
32 return -EINVAL;
33
34 return param_set_int(buf, kp);
35}
36
21/* Values of 0 to 4 will generate output */ 37/* Values of 0 to 4 will generate output */
22int edac_debug_level = 2; 38int edac_debug_level = 2;
23EXPORT_SYMBOL_GPL(edac_debug_level); 39EXPORT_SYMBOL_GPL(edac_debug_level);
40
41module_param_call(edac_debug_level, edac_set_debug_level, param_get_int,
42 &edac_debug_level, 0644);
43MODULE_PARM_DESC(edac_debug_level, "EDAC debug level: [0-4], default: 2");
24#endif 44#endif
25 45
26/* scope is to module level only */ 46/* scope is to module level only */
@@ -132,10 +152,3 @@ module_exit(edac_exit);
132MODULE_LICENSE("GPL"); 152MODULE_LICENSE("GPL");
133MODULE_AUTHOR("Doug Thompson www.softwarebitmaker.com, et al"); 153MODULE_AUTHOR("Doug Thompson www.softwarebitmaker.com, et al");
134MODULE_DESCRIPTION("Core library routines for EDAC reporting"); 154MODULE_DESCRIPTION("Core library routines for EDAC reporting");
135
136/* refer to *_sysfs.c files for parameters that are exported via sysfs */
137
138#ifdef CONFIG_EDAC_DEBUG
139module_param(edac_debug_level, int, 0644);
140MODULE_PARM_DESC(edac_debug_level, "Debug level");
141#endif