CC: [email protected] CC: [email protected] TO: Andrea Arcangeli <[email protected]> CC: Andrew Morton <[email protected]> CC: Linux Memory Management List <[email protected]> CC: [email protected]
From: kernel test robot <[email protected]> mm/userfaultfd.c:865:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) mm/userfaultfd.c:917:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h) Use BUG_ON instead of a if condition followed by BUG. Semantic patch information: This makes an effort to find cases where BUG() follows an if condition on an expression and replaces the if condition and BUG() with a BUG_ON having the conditional expression of the if statement as argument. Generated by: scripts/coccinelle/misc/bugon.cocci Fixes: f656fca095ea ("userfaultfd: UFFDIO_REMAP uABI") Reported-by: kernel test robot <[email protected]> Signed-off-by: kernel test robot <[email protected]> --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git main head: e37fc15fcde08ff18027c1a1e34b2371ac2c449b commit: f656fca095eaa2bc257fee306e02c92f229031c9 [38/50] userfaultfd: UFFDIO_REMAP uABI :::::: branch date: 23 hours ago :::::: commit date: 23 hours ago Please take the patch only if it's a positive warning. Thanks! userfaultfd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -860,9 +860,7 @@ static int remap_pages_pte(struct mm_str WRITE_ONCE(src_page->index, linear_page_index(dst_vma, dst_addr)); - if (!pte_same(ptep_clear_flush(src_vma, src_addr, src_pte), - orig_src_pte)) - BUG(); + BUG_ON(!pte_same(ptep_clear_flush(src_vma, src_addr, src_pte), orig_src_pte)); orig_dst_pte = mk_pte(src_page, dst_vma->vm_page_prot); orig_dst_pte = maybe_mkwrite(pte_mkdirty(orig_dst_pte), @@ -912,9 +910,7 @@ static int remap_pages_pte(struct mm_str return -EAGAIN; } - if (pte_val(ptep_get_and_clear(src_mm, src_addr, src_pte)) != - pte_val(orig_src_pte)) - BUG(); + BUG_ON(pte_val(ptep_get_and_clear(src_mm, src_addr, src_pte)) != pte_val(orig_src_pte)); set_pte_at(dst_mm, dst_addr, dst_pte, orig_src_pte); if (dst_mm != src_mm) { _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
