]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xtensa: fix address checks in dma_{alloc,free}_coherent
authorAlan Douglas <adouglas@cadence.com>
Wed, 23 Jul 2014 10:06:40 +0000 (14:06 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 20:40:56 +0000 (13:40 -0700)
commite6eb4fdf8e624fe7f7d037fee6c3363f18cb184b
tree9648b974b74ff922f486a6d150d3197a4dc17244
parent2f0871ed208074261e3bd2e2aef53fa54d3c30ea
xtensa: fix address checks in dma_{alloc,free}_coherent

commit 1ca49463c44c970b1ab1d71b0f268bfdf8427a7e upstream.

Virtual address is translated to the XCHAL_KSEG_CACHED region in the
dma_free_coherent, but is checked to be in the 0...XCHAL_KSEG_SIZE
range.

Change check for end of the range from 'addr >= X' to 'addr > X - 1' to
handle the case of X == 0.

Replace 'if (C) BUG();' construct with 'BUG_ON(C);'.

Signed-off-by: Alan Douglas <adouglas@cadence.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/kernel/pci-dma.c