diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-10 17:25:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-10 17:25:59 -0400 |
commit | ac3f482236793c75caae2c2ebb3f3e5f8b7393e1 (patch) | |
tree | f769225f9a77ae1e026b18d3d9260f5e5aefe99d /lib | |
parent | 85be928c4101670f99cdd7c927798aa4dcbb3168 (diff) | |
parent | f39d1b9792881ce4eb982ec8cc65258bf95674b5 (diff) |
Merge branch 'core-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
dma-debug: Fix the overlap() function to be correct and readable
oprofile: reset bt_lost_no_mapping with other stats
x86/oprofile: rename kernel parameter for architectural perfmon to arch_perfmon
signals: declare sys_rt_tgsigqueueinfo in syscalls.h
rcu: Mark Hierarchical RCU no longer experimental
dma-debug: Put all hash-chain locks into the same lock class
dma-debug: fix off-by-one error in overlap function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dma-debug.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 3b93129a968c..65b0d99b6d0a 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -716,7 +716,7 @@ void dma_debug_init(u32 num_entries) | |||
716 | 716 | ||
717 | for (i = 0; i < HASH_SIZE; ++i) { | 717 | for (i = 0; i < HASH_SIZE; ++i) { |
718 | INIT_LIST_HEAD(&dma_entry_hash[i].list); | 718 | INIT_LIST_HEAD(&dma_entry_hash[i].list); |
719 | dma_entry_hash[i].lock = SPIN_LOCK_UNLOCKED; | 719 | spin_lock_init(&dma_entry_hash[i].lock); |
720 | } | 720 | } |
721 | 721 | ||
722 | if (dma_debug_fs_init() != 0) { | 722 | if (dma_debug_fs_init() != 0) { |
@@ -856,22 +856,21 @@ static void check_for_stack(struct device *dev, void *addr) | |||
856 | "stack [addr=%p]\n", addr); | 856 | "stack [addr=%p]\n", addr); |
857 | } | 857 | } |
858 | 858 | ||
859 | static inline bool overlap(void *addr, u64 size, void *start, void *end) | 859 | static inline bool overlap(void *addr, unsigned long len, void *start, void *end) |
860 | { | 860 | { |
861 | void *addr2 = (char *)addr + size; | 861 | unsigned long a1 = (unsigned long)addr; |
862 | unsigned long b1 = a1 + len; | ||
863 | unsigned long a2 = (unsigned long)start; | ||
864 | unsigned long b2 = (unsigned long)end; | ||
862 | 865 | ||
863 | return ((addr >= start && addr < end) || | 866 | return !(b1 <= a2 || a1 >= b2); |
864 | (addr2 >= start && addr2 < end) || | ||
865 | ((addr < start) && (addr2 >= end))); | ||
866 | } | 867 | } |
867 | 868 | ||
868 | static void check_for_illegal_area(struct device *dev, void *addr, u64 size) | 869 | static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len) |
869 | { | 870 | { |
870 | if (overlap(addr, size, _text, _etext) || | 871 | if (overlap(addr, len, _text, _etext) || |
871 | overlap(addr, size, __start_rodata, __end_rodata)) | 872 | overlap(addr, len, __start_rodata, __end_rodata)) |
872 | err_printk(dev, NULL, "DMA-API: device driver maps " | 873 | err_printk(dev, NULL, "DMA-API: device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len); |
873 | "memory from kernel text or rodata " | ||
874 | "[addr=%p] [size=%llu]\n", addr, size); | ||
875 | } | 874 | } |
876 | 875 | ||
877 | static void check_sync(struct device *dev, | 876 | static void check_sync(struct device *dev, |
@@ -969,7 +968,8 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, | |||
969 | entry->type = dma_debug_single; | 968 | entry->type = dma_debug_single; |
970 | 969 | ||
971 | if (!PageHighMem(page)) { | 970 | if (!PageHighMem(page)) { |
972 | void *addr = ((char *)page_address(page)) + offset; | 971 | void *addr = page_address(page) + offset; |
972 | |||
973 | check_for_stack(dev, addr); | 973 | check_for_stack(dev, addr); |
974 | check_for_illegal_area(dev, addr, size); | 974 | check_for_illegal_area(dev, addr, size); |
975 | } | 975 | } |