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

Unified · Split

kernel/dma/debug.c+2−12
@@ -1064,20 +1064,10 @@ static void check_for_stack(struct device *dev, · 1063 unmodified lines
10641064 }
10651065 }
10661066
1067−static 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−
10771067 static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)
10781068 {
1079− if (overlap(addr, len, _stext, _etext) ||
1080− overlap(addr, len, __start_rodata, __end_rodata))
1069+ if (memory_intersects(_stext, _etext, addr, len) ||
1070+ memory_intersects(__start_rodata, __end_rodata, addr, len))
10811071 err_printk(dev, NULL, "device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len);
10821072 }
10831073

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