Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2455966imd; Fri, 2 Nov 2018 11:42:34 -0700 (PDT) X-Google-Smtp-Source: AJdET5diVzemhQDv0rv626UZW2AeZ+10t3wNHS2eye1HcKNDKb8kTEIFMj9LjEJHvkmkPiBmIM8X X-Received: by 2002:a63:f30d:: with SMTP id l13mr11941875pgh.399.1541184154499; Fri, 02 Nov 2018 11:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184154; cv=none; d=google.com; s=arc-20160816; b=Q35MQ8UvQWztB50zVuP0JqakhYloQ4M1DyHJCEcBlvJWX3/5qKV7FHeGPY2EgbbAFA jl1jz2bv5hEj/hNP9tEhoJaGDXmFSLVQDF84l7X2OvzpsUB4ChY1x9/cqHu9LMgCWim+ xec10lW8dmj0MKsubwE9YMCbIX9O+FsnZsZNDEXiDHMBiHc9Yjs/Mp5kX0KfzP0eSarR 0WZ2sAdeQ0RiyuR54X00rFM/G5RMBMEhp3+GE/J4in9jqygGqnlNuibRuTPi9PFVL0Cx 699c4O3ZMfy2/n7ngi1alMXRlCJXvCACvd4EKngLl5Yte7zKOY3p3C9JH9ySPxE9XmZj qzTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZwT28fsz2svPFHovvOLaV28pCnTj3JQ8x9LaKqM7jvs=; b=LPI/yUuGXIKFcUQQ2HbardOHHhGAclvQIUSSnF905abuBRm6DzeMV5r2AZv5a6m3Ba HAr3erbrVixqkn7erJ9scPcswX+YncBPaJ5ASBi1XwLam3tR/uAv8QGDxxx9VqxXRjQg 0TqLwKGJPmCJNZu9TXAN3cFMSXuKK5/zKrRQNwY4PXBZQgfFCAx2n37y+GqFdp89Q2zt W50b3lsWHHLN5fGoidgdpw08t8KArZpobSdpnUzNPlw3oPC+AR9lq0aZA2S3neW2KDEm VDQz5Fcrywypc7LsAZRa1PPxRz6aPXW6B911dOo8sRNzA/TQGyiN4jd4G8dGksX6nG0V 0LBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sqMaofK4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19-v6si34601392pgl.278.2018.11.02.11.42.18; Fri, 02 Nov 2018 11:42:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sqMaofK4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729535AbeKCDtZ (ORCPT + 99 others); Fri, 2 Nov 2018 23:49:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:44044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728699AbeKCDtZ (ORCPT ); Fri, 2 Nov 2018 23:49:25 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDD1020847; Fri, 2 Nov 2018 18:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184073; bh=HlGfJHA08drQlx9ec41V3BVJRhnx61AOqUN3tZqd/aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqMaofK4xf19iPtRjjkuoXSYPrkRUN1fjVlbyC6/TR5tIAX14YCPUQHD3vkIe2lD7 VXS1omvmZfo3OjY4GquTtoRwwsqBIsCCFu+fzPibCFpXqQPkrT0LPJ1LJ3NBpkL34I szm2T/5vho2amOSBiaHFzmuM9hsqpzz8r8So/P5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Andrew Morton , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 4.18 071/150] mm/gup_benchmark: fix unsigned comparison to zero in __gup_benchmark_ioctl Date: Fri, 2 Nov 2018 19:33:53 +0100 Message-Id: <20181102182908.542632717@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 51896864579d5a3349740847083f4db5c6487164 ] get_user_pages_fast() will return negative value if no pages were pinned, then be converted to a unsigned, which is compared to zero, giving the wrong result. Link: http://lkml.kernel.org/r/20180921095015.26088-1-yuehaibing@huawei.com Fixes: 09e35a4a1ca8 ("mm/gup_benchmark: handle gup failures") Signed-off-by: YueHaibing Reviewed-by: Andrew Morton Cc: Michael S. Tsirkin Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- mm/gup_benchmark.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c index 6a473709e9b6..7405c9d89d65 100644 --- a/mm/gup_benchmark.c +++ b/mm/gup_benchmark.c @@ -19,7 +19,8 @@ static int __gup_benchmark_ioctl(unsigned int cmd, struct gup_benchmark *gup) { ktime_t start_time, end_time; - unsigned long i, nr, nr_pages, addr, next; + unsigned long i, nr_pages, addr, next; + int nr; struct page **pages; nr_pages = gup->size / PAGE_SIZE; -- 2.17.1