From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31327606A322 for ; Fri, 4 Dec 2026 14:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kaRGoRdn Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A49010E34A; Fri, 4 Dec 2026 14:02:26 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 256DB10E34A for ; Fri, 4 Dec 2026 14:02:20 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 35F31621D5; Fri, 4 Dec 2026 14:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0BF41F00934; Fri, 4 Dec 2026 14:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796392938; bh=uONvfQKqN+HmBgGesBhqcUQcTxyImsiFJXBywqZQ6zk=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=kaRGoRdnzBAbtj4FXShlV/cgrH5Y0nEKWaPYQCW61ETHP9Y3e5kzyicA1c99sDtpr RvIin5VmBW/IroP+G59F3r5XENscSB/xg9s1gaWXB7u7O3ZjyE0hOYQKxWFCrShaoG 5qODq2ndJgluTydd3vPiT7LPuEuO+/c+BV1pZNwqrT9u3BwTpgsu2afacsdj8fIjbj 8N7rkivg/IaJqqjU6LFjj+9H5Hcn8EXREKOYwLzQ55asKBg31Xju2BdEN/OwesVwuW JNPNxEruNLaB3iuEQzQeyXmuvcalo5MwqG9R/svqQSgYTdEzVnmvvAFsFK4TRx9ea4 ZKRmBRFnKHvrA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v1 2/4] drm/vkms: Make LUT test reusable To: "Robert Mader" , dri-devel@lists.freedesktop.org In-Reply-To: <20261204135131.195561-3-robert.mader@collabora.com> References: <20261204135131.195561-1-robert.mader@collabora.com> <20261204135131.195561-3-robert.mader@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:02:18 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/vkms: u16 sum overflow in vkms_color_test_inv_lut() -- commit 88ce71701c6dbe07fa8ad17d5f1c90963dd032aa Author: Robert Mader drm/vkms: Make LUT test reusable This commit factors the inverse LUT test logic out of vkms_color_srgb_inv_srgb() into a reusable vkms_color_test_inv_lut() helper and adds an average error tolerance check. > diff --git a/drivers/gpu/drm/vkms/tests/vkms_color_test.c b/drivers/gpu/d= rm/vkms/tests/vkms_color_test.c > index c3c61037cb711..409e7a7d6861f 100644 > --- a/drivers/gpu/drm/vkms/tests/vkms_color_test.c > +++ b/drivers/gpu/drm/vkms/tests/vkms_color_test.c > @@ -120,20 +120,35 @@ static void vkms_color_test_linear(struct kunit *te= st) > } > } > =20 > -static void vkms_color_srgb_inv_srgb(struct kunit *test) > +static void vkms_color_test_inv_lut(struct kunit *test, > + const struct vkms_color_lut *lut, > + const struct vkms_color_lut *inv_lut, > + u16 tolerance_max, > + u16 tolerance_avg) > { > - u16 srgb, final; > - u16 tolerance =3D 11; > + u16 sum =3D 0; > + u16 count =3D 0; > + u16 tmp, final; > u32 x; > =20 > for (u32 i =3D 0; i <=3D 4095; i++) { > x =3D i * U16_MAX / 4095; > - srgb =3D apply_lut_to_channel_value(&srgb_eotf, x, LUT_RED); > - final =3D apply_lut_to_channel_value(&srgb_inv_eotf, srgb, LUT_RED); > + tmp =3D apply_lut_to_channel_value(lut, x, LUT_RED); > + final =3D apply_lut_to_channel_value(inv_lut, tmp, LUT_RED); > + > + KUNIT_EXPECT_GE(test, final, (int)x - tolerance_max); > + KUNIT_EXPECT_LE(test, final, (int)x + tolerance_max); > =20 > - KUNIT_EXPECT_GE(test, final, (int)x - tolerance); > - KUNIT_EXPECT_LE(test, final, (int)x + tolerance); > + sum +=3D abs((int)x - final); > + count++; > } > + > + KUNIT_EXPECT_LE(test, sum / count, tolerance_avg); [Severity: Medium] Can sum overflow here? sum is a u16 accumulating errors across 4096 samples, so it wraps modulo 65536 as soon as the average error reaches 16 (and the true total can reach 4096 * U16_MAX). This caps sum / count at 15 and lets a regressed LUT falsely pass KUNIT_EXPECT_LE(test, sum / count, tolerance_avg). Using u32 for sum would avoid the overflow. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204135131.1955= 61-1-robert.mader@collabora.com?part=3D2