Commit ee974e01e5ef2914036f08c8e41d1a3fa8bfc9d9

Authored by David Howells
Committed by Ingo Molnar
1 parent 6a55617ed5

clocksource: check range

Check that the value being passed to parse_pmtmr() does not exceed the
limits of pmtmr_ioport.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

drivers/clocksource/acpi_pm.c
... ... @@ -226,9 +226,12 @@
226 226  
227 227 if (strict_strtoul(arg, 16, &base))
228 228 return -EINVAL;
229   -
  229 +#ifdef CONFIG_X86_64
  230 + if (base > UINT_MAX)
  231 + return -ERANGE;
  232 +#endif
230 233 printk(KERN_INFO "PMTMR IOPort override: 0x%04x -> 0x%04lx\n",
231   - (unsigned int)pmtmr_ioport, base);
  234 + pmtmr_ioport, base);
232 235 pmtmr_ioport = base;
233 236  
234 237 return 1;