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: 9983143 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 D43D26029B 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 C6781289EA for ; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB367289F6; 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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A8E289EA for ; Tue, 3 Oct 2017 15:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752504AbdJCPiS (ORCPT ); Tue, 3 Oct 2017 11:38:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57258 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752503AbdJCPiQ (ORCPT ); Tue, 3 Oct 2017 11:38:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D81F860CDD; 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=1507045095; bh=iWVUVcnuhi5IhX54P/JK5ZofYwqP2GpAhIAfnGc7PPU=; h=From:To:Cc:Subject:Date:From; b=fftZB2vCGvDnfaHlqFNI4RqOT7sjinrZXUcDIglAa8YWu46QbLPfJZ3IDNCBiBxOm gncvwWa6zG63ly4p7yAtiUY7CdBGheHamLOmuai8+6jVL0NQIP0tAKwiUKSy9smymq BDyWOvFQPXMM6cbfIuJP27ixPpVMQXoDgKTmfTw0= 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 Cc: linux-arm-msm@vger.kernel.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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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