diff --git a/mm/gup.c b/mm/gup.c index cc4fa18783ce..1c2ac7c66c30 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3215,6 +3215,9 @@ static int gup_fast_fallback(unsigned long start, unsigned long nr_pages, FOLL_PCI_P2PDMA | FOLL_HONOR_NUMA_FAULT))) return -EINVAL; + if (unlikely(!nr_pages)) + return 0; + if (gup_flags & FOLL_PIN) mm_set_has_pinned_flag(current->mm);