History

dma-debug: use memory_intersects() directly

There is already a memory_intersects() helper in sections.h, use memory_intersects() directly instead of private overlap().

Kefeng Wang committed 5 years ago

Commit 1d7db831 parent 36a21d51 file · +2 −12Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/dma/debug.c+2−12
@@ -1064,20 +1064,10 @@ static void check_for_stack(struct device *dev, · 1063 unmodified lines
1064 }1064 }
1065}1065}
1066 1066
1067static inline bool overlap(void *addr, unsigned long len, void *start, void *end)
1068{
1069 unsigned long a1 = (unsigned long)addr;
1070 unsigned long b1 = a1 + len;
1071 unsigned long a2 = (unsigned long)start;
1072 unsigned long b2 = (unsigned long)end;
1073
1074 return !(b1 <= a2 || a1 >= b2);
1075}
1076
1077static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)1067static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)
1078{1068{
1079 if (overlap(addr, len, _stext, _etext) ||1069 if (memory_intersects(_stext, _etext, addr, len) ||
1080 overlap(addr, len, __start_rodata, __end_rodata))1070 memory_intersects(__start_rodata, __end_rodata, addr, len))
1081 err_printk(dev, NULL, "device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len);1071 err_printk(dev, NULL, "device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len);
1082}1072}
1083 1073

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t