linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	John Hubbard <jhubbard@nvidia.com>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>, Peter Xu <peterx@redhat.com>,
	 Alex Williamson <alex.williamson@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	 David Hildenbrand <david@redhat.com>, Jan Kara <jack@suse.cz>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Weird code with change "mm/gup: clean up follow_pfn_pte() slightly"
Date: Thu, 3 Feb 2022 07:27:47 +0100	[thread overview]
Message-ID: <CAKXUXMxFK9bo8jDoRZbQ0r2j-JwAGg3Xc5cpAcLaHfwHddJ7ew@mail.gmail.com> (raw)

Dear John,

Your change "mm/gup: clean up follow_pfn_pte() slightly" (see Link),
visible in linux-next as commit 05fef840b5c6 ("mm/gup: clean up
follow_pfn_pte() slightly"), is somehow weird.

In the new branch if (pages), you set page = ERR_PTR(-EFAULT) and goto
out. However, at the label out, the value of page is not used, but the
return uses the variables i and ret.

Static analysis tools, such as clang-analyzer, rightfully complain
about such weird code.

Maybe you can have another look at what you intended to set in the
branch of that commit or if you intend to jump to the label out?


Best regards,

Lukas

Link: https://lkml.kernel.org/r/20220201101108.306062-3-jhubbard@nvidia.com


             reply	other threads:[~2022-02-03  6:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03  6:27 Lukas Bulwahn [this message]
2022-02-03  8:38 ` John Hubbard
2022-02-03 13:01   ` Jason Gunthorpe
2022-02-03 20:44     ` John Hubbard
2022-02-04  0:45       ` Jason Gunthorpe
2022-02-04  0:59         ` John Hubbard
2022-02-04  1:06           ` Jason Gunthorpe
2022-02-04  1:22             ` John Hubbard
2022-02-04  1:26               ` Jason Gunthorpe

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=CAKXUXMxFK9bo8jDoRZbQ0r2j-JwAGg3Xc5cpAcLaHfwHddJ7ew@mail.gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=david@redhat.com \
    --cc=jack@suse.cz \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    /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