diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-10 21:38:02 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-10 22:18:45 +0200 |
commit | f39d1b9792881ce4eb982ec8cc65258bf95674b5 (patch) | |
tree | 07f945a2a6f0b1f2fb2af759e386781d0e0bed3f /block | |
parent | 2b8777ca0c944bf6498c45ed9c5c246bd63a719e (diff) | |
download | op-kernel-dev-f39d1b9792881ce4eb982ec8cc65258bf95674b5.zip op-kernel-dev-f39d1b9792881ce4eb982ec8cc65258bf95674b5.tar.gz |
dma-debug: Fix the overlap() function to be correct and readable
Linus noticed how unclean and buggy the overlap() function is:
- It uses convoluted (and bug-causing) positive checks for
range overlap - instead of using a more natural negative
check.
- Even the positive checks are buggy: a positive intersection
check has four natural cases while we checked only for three,
missing the (addr < start && addr2 == end) case for example.
- The variables are mis-named, making it non-obvious how the
check was done.
- It needlessly uses u64 instead of unsigned long. Since these
are kernel memory pointers and we explicitly exclude highmem
ranges anyway we cannot ever overflow 32 bits, even if we
could. (and on 64-bit it doesnt matter anyway)
All in one, this function needs a total revamp. I used Linus's
suggestions minus the paranoid checks (we cannot overflow really
because if we get totally bad DMA ranges passed far more things
break in the systems than just DMA debugging). I also fixed a
few other small details i noticed.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions