From mboxrd@z Thu Jan 1 00:00:00 1970 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 B340BEE20A6 for ; Fri, 6 Feb 2026 13:53:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2461310E780; Fri, 6 Feb 2026 13:53:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="FXAMDs/i"; dkim-atps=neutral Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC64B10E06D for ; Fri, 6 Feb 2026 13:53:15 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 9826F4E42444; Fri, 6 Feb 2026 13:53:14 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 6E97060729; Fri, 6 Feb 2026 13:53:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CAE58119D1D0B; Fri, 6 Feb 2026 14:53:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770385993; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=AKHu5N02Yogs/kPvZcW42Zgu3Eq1uHqj1jEkbTP4ihs=; b=FXAMDs/iw5ghNBQustvfDdQxtZKPxZ1ASesozSqtbLCq8lcPiIlZJq/EQQOoHKrJw30jTj ZMvgOxwXusbEgIJidAZ0FZ+i0TU3uK4XMgPYfLeWLsnH1/WX19wIzsLvT54W9YZbzITJiA Ad1xjOjGn/H4T4R3rsUCwzbdXywryaqpBPZL9cFgcWqmH3Xsz3uxC61thyA4EY5s3dinrs yHTg3wFP+QS4/th9QTxFQGZCNQcpCZ7gAIuInqqQEu7S8cVX+KYDuorbkf4Gzz/FRWCwHS RCYS5HWuz2q0ttSPXiGhYtuB3+SP8BVcSDagCtNQodBPYLYs2WXZj5+dh2qPgQ== Message-ID: <5ee4e72c-0862-40b3-b47b-70ca5d8f89c1@bootlin.com> Date: Fri, 6 Feb 2026 14:53:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Louis Chauvet Subject: Re: [PATCH] drm/vkms: fix gamma LUT size check To: Renjun Wang , hamohammed.sa@gmail.com, simona@ffwll.ch, melissa.srw@gmail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 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" On 2/4/26 15:15, Renjun Wang wrote: > vkms_atomic_check() computed the gamma LUT entry count using > sizeof(struct drm_color_lut *), which uses pointer size and > can incorrectly reject or accept LUT sizes. Use > drm_color_lut_size() instead to validate against VKMS_LUT_SIZE. > > Signed-off-by: Renjun Wang Reviewed-by: Louis Chauvet Like for the YUV patch, were you able to reproduce it using a tool? > --- > drivers/gpu/drm/vkms/vkms_drv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c > index dd1402f43773..a09589949f48 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.c > +++ b/drivers/gpu/drm/vkms/vkms_drv.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -111,8 +112,7 @@ static int vkms_atomic_check(struct drm_device *dev, struct drm_atomic_state *st > if (!new_crtc_state->gamma_lut || !new_crtc_state->color_mgmt_changed) > continue; > > - if (new_crtc_state->gamma_lut->length / sizeof(struct drm_color_lut *) > - > VKMS_LUT_SIZE) > + if (drm_color_lut_size(new_crtc_state->gamma_lut) > VKMS_LUT_SIZE) > return -EINVAL; > } >