From: coverity-bot <keescook@chromium.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
Nicolin Chen <nicolinc@nvidia.com>, Yi Liu <yi.l.liu@intel.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Coverity: iopt_map_user_pages(): Null pointer dereferences
Date: Wed, 2 Nov 2022 12:57:05 -0700 [thread overview]
Message-ID: <202211021256.2F571DFD@keescook> (raw)
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221102 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Mon Oct 31 13:37:57 2022 -0300
91b4be750274 ("iommufd: Data structure to provide IOVA to PFN mapping")
Coverity reported the following:
*** CID 1527090: Null pointer dereferences (REVERSE_INULL)
/drivers/iommu/iommufd/io_pagetable.c: 417 in iopt_map_user_pages()
411 list_add(&elm.next, &pages_list);
412
413 rc = iopt_map_pages(iopt, &pages_list, length, iova, iommu_prot, flags);
414 if (rc) {
415 if (elm.area)
416 iopt_abort_area(elm.area);
vvv CID 1527090: Null pointer dereferences (REVERSE_INULL)
vvv Null-checking "elm.pages" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
417 if (elm.pages)
418 iopt_put_pages(elm.pages);
419 return rc;
420 }
421 return 0;
422 }
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527090 ("Null pointer dereferences")
Fixes: 91b4be750274 ("iommufd: Data structure to provide IOVA to PFN mapping")
This looks like the earlier "if (IS_ERR(elm.pages))" should use
IS_ERR_OR_NULL() ?
Thanks for your attention!
--
Coverity-bot
next reply other threads:[~2022-11-02 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-02 19:57 coverity-bot [this message]
2022-11-02 20:14 ` Coverity: iopt_map_user_pages(): Null pointer dereferences 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=202211021256.2F571DFD@keescook \
--to=keescook@chromium.org \
--cc=gustavo@embeddedor.com \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=yi.l.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.