aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/sysfs.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 8979e4a8d066..40a42655227c 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -164,14 +164,18 @@ static const struct kernel_param_ops param_ops_debug_level = {
164module_param_cb(debug_layer, &param_ops_debug_layer, &acpi_dbg_layer, 0644); 164module_param_cb(debug_layer, &param_ops_debug_layer, &acpi_dbg_layer, 0644);
165module_param_cb(debug_level, &param_ops_debug_level, &acpi_dbg_level, 0644); 165module_param_cb(debug_level, &param_ops_debug_level, &acpi_dbg_level, 0644);
166 166
167static char* trace_method_name; 167static char trace_method_name[1024];
168static bool trace_method_kmalloced;
169 168
170int param_set_trace_method_name(const char *val, const struct kernel_param *kp) 169int param_set_trace_method_name(const char *val, const struct kernel_param *kp)
171{ 170{
172 u32 saved_flags = 0; 171 u32 saved_flags = 0;
172 bool is_abs_path = true;
173 173
174 if (strlen(val) > 1024) { 174 if (*val != '\\')
175 is_abs_path = false;
176
177 if ((is_abs_path && strlen(val) > 1023) ||
178 (!is_abs_path && strlen(val) > 1022)) {
175 pr_err("%s: string parameter too long\n", kp->name); 179 pr_err("%s: string parameter too long\n", kp->name);
176 return -ENOSPC; 180 return -ENOSPC;
177 } 181 }
@@ -187,19 +191,13 @@ int param_set_trace_method_name(const char *val, const struct kernel_param *kp)
187 acpi_gbl_trace_dbg_layer, 191 acpi_gbl_trace_dbg_layer,
188 0); 192 0);
189 193
190 if (trace_method_kmalloced)
191 kfree(trace_method_name);
192 trace_method_name = NULL;
193 trace_method_kmalloced = false;
194
195 /* This is a hack. We can't kmalloc in early boot. */ 194 /* This is a hack. We can't kmalloc in early boot. */
196 if (slab_is_available()) { 195 if (is_abs_path)
197 trace_method_name = kstrdup(val, GFP_KERNEL); 196 strcpy(trace_method_name, val);
198 if (!trace_method_name) 197 else {
199 return -ENOMEM; 198 trace_method_name[0] = '\\';
200 trace_method_kmalloced = true; 199 strcpy(trace_method_name+1, val);
201 } else 200 }
202 trace_method_name = (char *)val;
203 201
204 /* Restore the original tracer state */ 202 /* Restore the original tracer state */
205 (void)acpi_debug_trace(trace_method_name, 203 (void)acpi_debug_trace(trace_method_name,