lkml.org 
[lkml]   [2022]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Weird code with change "mm/gup: clean up follow_pfn_pte() slightly"
On Thu, Feb 03, 2022 at 05:22:36PM -0800, John Hubbard wrote:
> > So why do we return 0, if it means an error, instead of returning the
> > actual errno?
>
> Well, now returning 0 sounds all wrong, when you put it like that. :)
>
> So, simply this approach? :
>
> @@ -1205,8 +1201,15 @@ static long __get_user_pages(struct mm_struct *mm,
> } else if (PTR_ERR(page) == -EEXIST) {
> /*
> * Proper page table entry exists, but no corresponding
> - * struct page.
> + * struct page. If the caller expects **pages to be
> + * filled in, bail out now, because that can't be done
> + * for this page.
> */
> + if (pages) {
> + ret = PTR_ERR(page);
> + goto out;
> + }
> +
> goto next_page;
> } else if (IS_ERR(page)) {
> ret = PTR_ERR(page);

It is what I had in mind, I certainly wouldn't add a new condition
that returns 0..

Jason

\
 
 \ /
  Last update: 2022-02-04 02:27    [W:0.559 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site