diff options
author | Ingo Molnar <mingo@elte.hu> | 2012-03-13 15:32:54 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-03-13 15:33:03 (GMT) |
commit | ef15eda98217f5183f457e7a2de8b79555ef908b (patch) | |
tree | f8f22b48f7bb237c9aa6646175f3e17eeac4af0e /lib | |
parent | 5cb4ac3a583d4ee18c8682ab857e093c4a0d0895 (diff) | |
parent | ef334a20d84f52407a8a2afd02ddeaecbef0ad3d (diff) | |
download | linux-ef15eda98217f5183f457e7a2de8b79555ef908b.tar.xz |
Merge branch 'x86/cleanups' into perf/uprobes
Merge reason: We want to merge a dependent patch.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 3 | ||||
-rw-r--r-- | lib/kstrtox.c | 18 | ||||
-rw-r--r-- | lib/pci_iomap.c | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index d69d321..028aba9 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -19,6 +19,9 @@ config RATIONAL config GENERIC_FIND_FIRST_BIT bool +config NO_GENERIC_PCI_IOPORT_MAP + bool + config GENERIC_PCI_IOMAP bool diff --git a/lib/kstrtox.c b/lib/kstrtox.c index 7a94c8f..b1dd3e7 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -44,12 +44,13 @@ const char *_parse_integer_fixup_radix(const char *s, unsigned int *base) * * Don't you dare use this function. */ -unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *res) +unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p) { + unsigned long long res; unsigned int rv; int overflow; - *res = 0; + res = 0; rv = 0; overflow = 0; while (*s) { @@ -64,12 +65,19 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long if (val >= base) break; - if (*res > div_u64(ULLONG_MAX - val, base)) - overflow = 1; - *res = *res * base + val; + /* + * Check for overflow only if we are within range of + * it in the max base we support (16) + */ + if (unlikely(res & (~0ull << 60))) { + if (res > div_u64(ULLONG_MAX - val, base)) + overflow = 1; + } + res = res * base + val; rv++; s++; } + *p = res; if (overflow) rv |= KSTRTOX_OVERFLOW; return rv; diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c index 4b0fdc2..0d83ea8 100644 --- a/lib/pci_iomap.c +++ b/lib/pci_iomap.c @@ -34,7 +34,7 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) if (maxlen && len > maxlen) len = maxlen; if (flags & IORESOURCE_IO) - return ioport_map(start, len); + return __pci_ioport_map(dev, start, len); if (flags & IORESOURCE_MEM) { if (flags & IORESOURCE_CACHEABLE) return ioremap(start, len); |