linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Unsigned 'nr_pages' always larger than zero
@ 2019-09-04 10:26 zhong jiang
  2019-09-04 11:24 ` Vlastimil Babka
  0 siblings, 1 reply; 12+ messages in thread
From: zhong jiang @ 2019-09-04 10:26 UTC (permalink / raw)
  To: akpm, mhocko
  Cc: anshuman.khandual, vbabka, zhongjiang, linux-mm, linux-kernel

With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"'
compare with zero. And __get_user_pages_locked will return an long value.
Hence, Convert the long to compare with zero is feasible.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 mm/gup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index 23a9f9c..956d5a1 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1508,7 +1508,7 @@ static long check_and_migrate_cma_pages(struct task_struct *tsk,
 						   pages, vmas, NULL,
 						   gup_flags);
 
-		if ((nr_pages > 0) && migrate_allow) {
+		if (((long)nr_pages > 0) && migrate_allow) {
 			drain_allow = true;
 			goto check_again;
 		}
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-10-17  1:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 10:26 [PATCH] mm: Unsigned 'nr_pages' always larger than zero zhong jiang
2019-09-04 11:24 ` Vlastimil Babka
     [not found]   ` <2807E5FD2F6FDA4886F6618EAC48510E898E9559@CRSMSX101.amr.corp.intel.com>
2019-09-04 18:39     ` Matthew Wilcox
2019-09-04 18:48   ` Andrew Morton
2019-09-04 20:40     ` Vlastimil Babka
2019-09-05  6:18     ` zhong jiang
2019-09-05  7:19       ` Vlastimil Babka
     [not found]     ` <73c49a1b-4f42-c21d-ccd8-2b063cdf1293@nvidia.com>
     [not found]       ` <5DA6DDE0.6000804@huawei.com>
2019-10-17  0:49         ` Andrew Morton
2019-10-17  1:38           ` zhong jiang
2019-09-04 19:01   ` Andrew Morton
2019-09-04 20:44     ` Vlastimil Babka
2019-09-05  2:05   ` zhong jiang

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).