From patchwork Sun Sep 8 12:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13795423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EC7FECE57A for ; Sun, 8 Sep 2024 12:11:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3DC410E21A; Sun, 8 Sep 2024 12:11:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.b="GIZQHfKg"; dkim-atps=neutral Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id C09A010E21A for ; Sun, 8 Sep 2024 12:11:26 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725797485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2wcen4kcvpDwIaeiESKNLrKqnOT9ib0C4GbjhHrhdTA=; b=GIZQHfKgy0pDhySpoGH5JNeNHg/YMH071QNMYmYOMZTsFuR4oUBMvYaQvDKyTWrkDQQoem WEOrUbDyDn+a/SJcTvoaH2APqQuzaNbxlFKGAMosl6gCbbt5DV9+XiZORhgejJxb3eDIpU p0kvjnJCW2L7ImTPlhiL+9WYs11LhdQ= From: Sui Jingfeng To: Lucas Stach Cc: Christian Gmeiner , Russell King , David Airlie , Daniel Vetter , Thomas Zimmermann , Maxime Ripard , dri-devel@lists.freedesktop.org, etnaviv@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng , Christian Gmeiner Subject: [PATCH v2 2/5] drm/etnaviv: Use 'unsigned' type to count the number of pages Date: Sun, 8 Sep 2024 20:11:04 +0800 Message-ID: <20240908121107.328740-2-sui.jingfeng@linux.dev> In-Reply-To: <20240908121107.328740-1-sui.jingfeng@linux.dev> References: <20240908121107.328740-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The unpin_user_pages() function takes an 'unsigned long' argument to store the number of userspace pages, and the struct drm_gem_object::size is a size_t type. The number of pages can not be negative, hence, use 'unsigned' variable to count the number of pages. Reviewed-by: Christian Gmeiner Signed-off-by: Sui Jingfeng --- v2: Pick up tags and improve commit message drivers/gpu/drm/etnaviv/etnaviv_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index 5ffc31f32ac9..4ce3d2ea7767 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c @@ -686,7 +686,7 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj) kfree(etnaviv_obj->sgt); } if (etnaviv_obj->pages) { - int npages = etnaviv_obj->base.size >> PAGE_SHIFT; + unsigned int npages = etnaviv_obj->base.size >> PAGE_SHIFT; unpin_user_pages(etnaviv_obj->pages, npages); kvfree(etnaviv_obj->pages);