From: Shigeru Yoshida <syoshida@redhat.com>
To: dan.carpenter@oracle.com
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm/gup.c: Fix return value for __gup_longterm_locked()
Date: Sun, 28 Aug 2022 07:36:57 +0900 (JST) [thread overview]
Message-ID: <20220828.073657.766389803686589716.syoshida@redhat.com> (raw)
In-Reply-To: <Ywcph3G5gKo/iobr@kili>
Hi Dan,
On Thu, 25 Aug 2022 10:49:27 +0300, Dan Carpenter wrote:
> Hello Shigeru Yoshida,
>
> The patch 35f9c4607f9e: "mm/gup.c: Fix return value for
> __gup_longterm_locked()" from Aug 22, 2022, leads to the following
> Smatch static checker warning:
>
> mm/gup.c:2089 __gup_longterm_locked()
> error: uninitialized symbol 'rc'.
>
> mm/gup.c
> 2064 static long __gup_longterm_locked(struct mm_struct *mm,
> 2065 unsigned long start,
> 2066 unsigned long nr_pages,
> 2067 struct page **pages,
> 2068 struct vm_area_struct **vmas,
> 2069 unsigned int gup_flags)
> 2070 {
> 2071 unsigned int flags;
> 2072 long rc, nr_pinned_pages;
> 2073
> 2074 if (!(gup_flags & FOLL_LONGTERM))
> 2075 return __get_user_pages_locked(mm, start, nr_pages, pages, vmas,
> 2076 NULL, gup_flags);
> 2077 flags = memalloc_pin_save();
> 2078 do {
> 2079 nr_pinned_pages = __get_user_pages_locked(mm, start, nr_pages,
> 2080 pages, vmas, NULL,
> 2081 gup_flags);
> 2082 if (nr_pinned_pages <= 0)
>
>
> This doesn't work if if fails on the first iteration. But also I'm
> surprised that we are return -EAGAIN on subsequent iterations...
Sorry for late response and thanks for your bug report. Yes, that's
my fault. I'll prepare the patch.
Thanks,
Shigeru
>
> 2083 break;
> 2084 rc = check_and_migrate_movable_pages(nr_pinned_pages, pages,
> 2085 gup_flags);
> 2086 } while (rc == -EAGAIN);
> 2087 memalloc_pin_restore(flags);
> 2088
> --> 2089 return rc ? rc : nr_pinned_pages;
> 2090 }
>
> regards,
> dan carpenter
>
prev parent reply other threads:[~2022-08-27 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 7:49 Dan Carpenter
2022-08-27 22:36 ` Shigeru Yoshida [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220828.073657.766389803686589716.syoshida@redhat.com \
--to=syoshida@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox