diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2009-04-14 04:26:30 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-28 12:24:15 -0400 |
commit | 9319cec8c185e84fc5281afb6ac5d4c47a234841 (patch) | |
tree | 983c708aaa5bba2671787a886e03fe6226b1eb6a | |
parent | 8780e8e0f6b34862cdf2c62d4d2674d6bc3207db (diff) |
x86, mce: use strict_strtoull
Use strict_strtoull instead of simple_strtoull.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 16 |
2 files changed, 10 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 8ab28368bb92..4375ffb5459f 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1059,18 +1059,17 @@ static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, | |||
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, | 1061 | static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, |
1062 | const char *buf, size_t siz) | 1062 | const char *buf, size_t size) |
1063 | { | 1063 | { |
1064 | char *end; | 1064 | u64 new; |
1065 | u64 new = simple_strtoull(buf, &end, 0); | ||
1066 | 1065 | ||
1067 | if (end == buf) | 1066 | if (strict_strtoull(buf, 0, &new) < 0) |
1068 | return -EINVAL; | 1067 | return -EINVAL; |
1069 | 1068 | ||
1070 | bank[attr - bank_attrs] = new; | 1069 | bank[attr - bank_attrs] = new; |
1071 | mce_restart(); | 1070 | mce_restart(); |
1072 | 1071 | ||
1073 | return end-buf; | 1072 | return size; |
1074 | } | 1073 | } |
1075 | 1074 | ||
1076 | static ssize_t | 1075 | static ssize_t |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index 083f270251fa..0c563432e25c 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -269,14 +269,12 @@ SHOW_FIELDS(interrupt_enable) | |||
269 | SHOW_FIELDS(threshold_limit) | 269 | SHOW_FIELDS(threshold_limit) |
270 | 270 | ||
271 | static ssize_t | 271 | static ssize_t |
272 | store_interrupt_enable(struct threshold_block *b, const char *buf, size_t count) | 272 | store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size) |
273 | { | 273 | { |
274 | struct thresh_restart tr; | 274 | struct thresh_restart tr; |
275 | unsigned long new; | 275 | unsigned long new; |
276 | char *end; | ||
277 | 276 | ||
278 | new = simple_strtoul(buf, &end, 0); | 277 | if (strict_strtoul(buf, 0, &new) < 0) |
279 | if (end == buf) | ||
280 | return -EINVAL; | 278 | return -EINVAL; |
281 | 279 | ||
282 | b->interrupt_enable = !!new; | 280 | b->interrupt_enable = !!new; |
@@ -287,18 +285,16 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t count) | |||
287 | 285 | ||
288 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); | 286 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); |
289 | 287 | ||
290 | return end - buf; | 288 | return size; |
291 | } | 289 | } |
292 | 290 | ||
293 | static ssize_t | 291 | static ssize_t |
294 | store_threshold_limit(struct threshold_block *b, const char *buf, size_t count) | 292 | store_threshold_limit(struct threshold_block *b, const char *buf, size_t size) |
295 | { | 293 | { |
296 | struct thresh_restart tr; | 294 | struct thresh_restart tr; |
297 | unsigned long new; | 295 | unsigned long new; |
298 | char *end; | ||
299 | 296 | ||
300 | new = simple_strtoul(buf, &end, 0); | 297 | if (strict_strtoul(buf, 0, &new) < 0) |
301 | if (end == buf) | ||
302 | return -EINVAL; | 298 | return -EINVAL; |
303 | 299 | ||
304 | if (new > THRESHOLD_MAX) | 300 | if (new > THRESHOLD_MAX) |
@@ -313,7 +309,7 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t count) | |||
313 | 309 | ||
314 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); | 310 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); |
315 | 311 | ||
316 | return end - buf; | 312 | return size; |
317 | } | 313 | } |
318 | 314 | ||
319 | struct threshold_block_cross_cpu { | 315 | struct threshold_block_cross_cpu { |