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 Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 }




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux