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 33918606A31C for ; Sat, 28 Nov 2026 17:31:37 +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=mkar4sgn Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61BD610EA0C; Sat, 28 Nov 2026 17:31:31 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8890010EA0C for ; Sat, 28 Nov 2026 17:31:25 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 3B43B406BD; Sat, 28 Nov 2026 17:31:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BC3C1F00897; Sat, 28 Nov 2026 17:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795887084; bh=EPevu1ixKdPMtpmQndpx0JpzaBbhn+pmKYN7HtSsYWk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=mkar4sgn6htoh6V/yHtb2+O/INMKvCmv+nxMD6FtwOekgSMFDW2W+eSk+T52VAzED 9WTjGevGh3lPgCX0aoM7PlArIQZZ4wRrpgLQt1jdNa1JNd0wHJ4tTylVKTZOIhi2LE Zb8wyG1DtKlxmWcjlCp2RPmSpSATjbP8BkKv6mWecj7KA/uCpu5/WnRJiUnWQik9Ml GU+V7FXB6kNcQqMMJ0/iy8V3q2bj+RWHb3Od6i2FZaDPD0YO5uft2LeSvpztOR9HOB CMrakCfrDmvsKs5utrNEl7+BY59QekykQgIaiSEhqALuIQ/vs2WFYEfffZW0GhWG67 0QmerMswWuaRA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 6/7] drm/vkms: add a multiplier colorop To: "Oarora Etimis" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261128-colorop-v1-6-dd79919f822b@gmail.com> References: <20261128-colorop-v1-0-dd79919f822b@gmail.com> <20261128-colorop-v1-6-dd79919f822b@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 17:31:24 +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=-10.8 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 2 potential issues to consider: - [Medium] drm/vkms: NULL deref in vkms_initialize_color_pipeline() error cleanup - [Medium] drm/vkms: raw 64-bit divisions in LUT helpers break 32-bit builds -- commit c2a8c1681a0dfb65c3b0d103de4cd4216ec820ce Author: Oarora Etimis drm/vkms: add a multiplier colorop This commit adds a DRM_COLOROP_MULTIPLIER color operation to the VKMS plane color pipeline and implements per-channel S31.32 sign-magnitude gain scaling in the composer. > diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/vkms/v= kms_colorop.c > index cceb9acca0da0..1e1e470be4dda 100644 > --- a/drivers/gpu/drm/vkms/vkms_colorop.c > +++ b/drivers/gpu/drm/vkms/vkms_colorop.c > @@ -157,6 +157,23 @@ static int vkms_initialize_color_pipeline(struct drm= _plane *plane, struct drm_pr > =20 > drm_colorop_set_next_property(ops[i - 1], ops[i]); > =20 > + i++; > + > + /* 8th op: multiplier */ > + ops[i] =3D kzalloc_obj(*ops[i]); > + if (!ops[i]) { > + drm_err(dev, "KMS: Failed to allocate colorop\n"); > + ret =3D -ENOMEM; > + goto cleanup; > + } > + > + ret =3D drm_plane_colorop_mult_init(dev, ops[i], plane, &vkms_colorop_f= uncs, > + DRM_COLOROP_FLAG_ALLOW_BYPASS); > + if (ret) > + goto cleanup; [Severity: Medium] Can jumping to cleanup when drm_plane_colorop_mult_init() fails cause a NULL pointer dereference in drm_colorop_cleanup(ops[i])? drm_plane_colorop_mult_init() calls drm_plane_colorop_init(), which returns early if drm_mode_object_add() fails, before setting colorop->dev or adding colorop->head to config->colorop_list: drivers/gpu/drm/drm_colorop.c:drm_plane_colorop_init() { ... ret =3D drm_mode_object_add(dev, &colorop->base, DRM_MODE_OBJECT_COLOROP); if (ret) return ret; colorop->base.properties =3D &colorop->properties; colorop->dev =3D dev; ... list_add_tail(&colorop->head, &config->colorop_list); ... } Because the cleanup label loops up to j <=3D i, it calls drm_colorop_cleanup(ops[i]) on that partially initialized object, which runs list_del(&colorop->head) on an unlinked list head and dereferences the NULL colorop->dev pointer. > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/= vkms_composer.c > index 51ac2ae75cf0c..b94c51264c647 100644 > --- a/drivers/gpu/drm/vkms/vkms_composer.c > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > @@ -365,6 +365,17 @@ VISIBLE_IF_KUNIT void apply_3dlut_to_pixel(struct pi= xel_argb_s32 *pixel, > } > EXPORT_SYMBOL_IF_KUNIT(apply_3dlut_to_pixel); [Severity: Medium] Do the raw 64-bit divisions in apply_lut32_to_channel_value() and apply_3dlut_to_channel_value() break 32-bit builds with undefined references to __udivdi3 and __divdi3? Both helpers divide 64-bit values directly by U16_MAX instead of using 64-b= it division helpers such as div_u64() or DIV_ROUND_CLOSEST_ULL(): drivers/gpu/drm/vkms/vkms_composer.c:apply_lut32_to_channel_value() { ... position =3D (u64)channel_value * (lut_size - 1); index =3D position / U16_MAX; ... delta =3D (s64)ceil_value - (s64)floor_value; result =3D (s64)floor_value + DIV_ROUND_CLOSEST(delta * fraction, (s64)U16_MAX); ... } drivers/gpu/drm/vkms/vkms_composer.c:apply_3dlut_to_channel_value() { ... position =3D (u64)r * max_index; r_index =3D position / U16_MAX; ... position =3D (u64)g * max_index; g_index =3D position / U16_MAX; ... position =3D (u64)b * max_index; b_index =3D position / U16_MAX; ... } --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128-colorop-v1= -0-dd79919f822b@gmail.com?part=3D6