if (WARN_ON_ONCE(gup_flags & FOLL_GET))
                return -EINVAL;
 
+       if (WARN_ON_ONCE(!pages))
+               return -EINVAL;
+
        gup_flags |= FOLL_PIN;
        return internal_get_user_pages_fast(start, nr_pages, gup_flags, pages);
 }
         */
        if (WARN_ON_ONCE(gup_flags & FOLL_GET))
                return 0;
+
+       if (WARN_ON_ONCE(!pages))
+               return 0;
        /*
         * FOLL_FAST_ONLY is required in order to match the API description of
         * this routine: no fall back to regular ("slow") GUP.
  * @nr_pages:  number of pages from start to pin
  * @gup_flags: flags modifying lookup behaviour
  * @pages:     array that receives pointers to the pages pinned.
- *             Should be at least nr_pages long. Or NULL, if caller
- *             only intends to ensure the pages are faulted in.
+ *             Should be at least nr_pages long.
  * @vmas:      array of pointers to vmas corresponding to each page.
  *             Or NULL if the caller does not require them.
  * @locked:    pointer to lock flag indicating whether lock is held and
        if (WARN_ON_ONCE(gup_flags & FOLL_GET))
                return -EINVAL;
 
+       if (WARN_ON_ONCE(!pages))
+               return -EINVAL;
+
        gup_flags |= FOLL_PIN;
        return __get_user_pages_remote(mm, start, nr_pages, gup_flags,
                                       pages, vmas, locked);
  * @nr_pages:  number of pages from start to pin
  * @gup_flags: flags modifying lookup behaviour
  * @pages:     array that receives pointers to the pages pinned.
- *             Should be at least nr_pages long. Or NULL, if caller
- *             only intends to ensure the pages are faulted in.
+ *             Should be at least nr_pages long.
  * @vmas:      array of pointers to vmas corresponding to each page.
  *             Or NULL if the caller does not require them.
  *
        if (WARN_ON_ONCE(gup_flags & FOLL_GET))
                return -EINVAL;
 
+       if (WARN_ON_ONCE(!pages))
+               return -EINVAL;
+
        gup_flags |= FOLL_PIN;
        return __gup_longterm_locked(current->mm, start, nr_pages,
                                     pages, vmas, gup_flags);
        if (WARN_ON_ONCE(gup_flags & FOLL_GET))
                return -EINVAL;
 
+       if (WARN_ON_ONCE(!pages))
+               return -EINVAL;
+
        gup_flags |= FOLL_PIN;
        return get_user_pages_unlocked(start, nr_pages, pages, gup_flags);
 }