From patchwork Tue Oct 3 15:38:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 9983141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F9F86038E for ; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 619CA289EA for ; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56673289F6; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B133289EA for ; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 373B26E0B8; Tue, 3 Oct 2017 15:38:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5331D89F19 for ; Tue, 3 Oct 2017 15:38:16 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id ECCF360C07; Tue, 3 Oct 2017 15:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1507045096; bh=iWVUVcnuhi5IhX54P/JK5ZofYwqP2GpAhIAfnGc7PPU=; h=From:To:Cc:Subject:Date:From; b=gGk232AtYWjQr0rqX8bD8kBZtdD+VeFqEDktB/7Cw7AQcJwCzobszzPjcdclyxuVS bPooqKNsmIkn2FHiYB6XuY/Zt0VO66NoTq3PKqRP7aTGLKONKAOXpF3fM0fOqkLVaz dwGzc5C3pjMunmOvmnPIdIzB01RGFG9KH03EJOvY= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 06E4360C07; Tue, 3 Oct 2017 15:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1507045095; bh=iWVUVcnuhi5IhX54P/JK5ZofYwqP2GpAhIAfnGc7PPU=; h=From:To:Cc:Subject:Date:From; b=fftZB2vCGvDnfaHlqFNI4RqOT7sjinrZXUcDIglAa8YWu46QbLPfJZ3IDNCBiBxOm gncvwWa6zG63ly4p7yAtiUY7CdBGheHamLOmuai8+6jVL0NQIP0tAKwiUKSy9smymq BDyWOvFQPXMM6cbfIuJP27ixPpVMQXoDgKTmfTw0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 06E4360C07 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: use size_t variables to iterate through pages Date: Tue, 3 Oct 2017 09:38:11 -0600 Message-Id: <1507045091-6550-2-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 1.9.1 Cc: linux-arm-msm@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drm_gem_get_pages() and drm_gem_put_pages() calculate the number of pages to operate on from obj->size which is a size_t. Use similarly sized variables to calculate and iterate through the pages to avoid possibly losing bits from the page calculation. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index af62017..a8c146d 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -550,7 +550,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj) { struct address_space *mapping; struct page *p, **pages; - int i, npages; + size_t i, npages; /* This is the shared memory object that backs the GEM resource */ mapping = obj->filp->f_mapping; @@ -603,7 +603,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj) void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, bool dirty, bool accessed) { - int i, npages; + size_t i, npages; /* We already BUG_ON() for non-page-aligned sizes in * drm_gem_object_init(), so we should never hit this unless