linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: kernel test robot <lkp@intel.com>
Cc: Christoph Hellwig <hch@lst.de>,
	kbuild-all@lists.01.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 13152/13159] drivers/gpu/drm/i915/gt/shmem_utils.c:76 shmem_pin_map() warn: always true condition '(--i >= 0) => (0-u64max >= 0)'
Date: Tue, 6 Oct 2020 09:55:41 +0200	[thread overview]
Message-ID: <20201006075541.GA10243@lst.de> (raw)
In-Reply-To: <202010040517.GzLE38rk-lkp@intel.com>

Thanks for the report.  The patch below takes care of it, and also
uses the right type for a page index.  Andrew, can you fold it in?

diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c b/drivers/gpu/drm/i915/gt/shmem_utils.c
index f011ea42487e11..4f043f2520f78d 100644
--- a/drivers/gpu/drm/i915/gt/shmem_utils.c
+++ b/drivers/gpu/drm/i915/gt/shmem_utils.c
@@ -52,7 +52,7 @@ struct file *shmem_create_from_object(struct drm_i915_gem_object *obj)
 void *shmem_pin_map(struct file *file)
 {
 	struct page **pages;
-	size_t n_pages, i;
+	pgoff_t n_pages, i, j;
 	void *vaddr;
 
 	n_pages = file->f_mapping->host->i_size >> PAGE_SHIFT;
@@ -73,8 +73,8 @@ void *shmem_pin_map(struct file *file)
 	mapping_set_unevictable(file->f_mapping);
 	return vaddr;
 err_page:
-	while (--i >= 0)
-		put_page(pages[i]);
+	for (j = 0; j < i; j++)
+		put_page(pages[j]);
 	kvfree(pages);
 	return NULL;
 }


      reply	other threads:[~2020-10-06  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 21:07 [linux-next:master 13152/13159] drivers/gpu/drm/i915/gt/shmem_utils.c:76 shmem_pin_map() warn: always true condition '(--i >= 0) => (0-u64max >= 0)' kernel test robot
2020-10-06  7:55 ` Christoph Hellwig [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=20201006075541.GA10243@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=tvrtko.ursulin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).