From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796178030; b=KoYCFtu43l2V6JZXwTvnJnhF9wDN+xziFNj9CKOMux/4abDdxtUHWV7kHBPwhDdOQ85b dgL1gmBHLrKFa3ttjdwN6hYCIisPzbsgNjfvIqInY1rwcAVu1J03YXSVr+qGjl2ZMQBr9 Mk+zbKNSMSSTcfLkahW1lQUCcRZsDKE4DZ4oky+/OKVqABezySZ1tfJ0BymL7U3hxF/xX 0ShZLUWhQb+NGBTRgMJnrc4KN3Xy51ZQo6EeGuZiBzfZWWyw04W7mTBzxspGIR2pgG8Am CmonJUDR6ll1XXz08T5yOybKZQzB0z9meQ6n8mbaIQTWu3CBbDUyCauNk5sCf8pq6Kg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796178030; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer; bh=3zZxNkElAxeiM+e26V+fLcUG6IGK6HooX+9png+4DKk=; b=hfU9hJtd+8RZBgJoFecD8GiUSN/v19yNVrpVfzcWpY9m2XEVqEh3tgdIUkFXPVjp7nbM twPVz+KiGvVO7Va/LTEeREIe4dLR/BfNCTLwUuL7zLeXjL6JFl05yxLtIdQMa4Z4VABKv 3SwJHkQPs6ruH2FN6oGv2JQd5EV572CdYK6l9dIKM3Q4oddotuYMDH/xZez3WUCUB3WSv 9z9k9olszRXOhq1KzyWGsaaYojaYWO+cuRkE0pQfvbksWtvl/kgy1e7kEn4dH3fpc4yLy poR4wL97x7wQlTZ6UgoRzz++8AGYv/vNj7O6w157LAwjrVKiVX8pGcAOJggHNK1v2Ow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=a1D11Cqx; arc=none smtp.remote-ip=148.251.105.195 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F318606A695; Wed, 2 Dec 2026 02:20:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4F318606A695 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=a1D11Cqx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796178026; bh=zlf2x+KGA5iJ6tnmZtkC/J26rbiQaeklOApfPfog/lA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=a1D11CqxBgiqq3c0CXI7gceoHTxbD+4+vbx//EZTi+jY32zjk4Od5FcUBAfSjCSoW a4MO1QeHzJtB2hlQnsbEife1UgXjI6j/VVTwGrJHUGqqPwzidViiSSqhHNcxANRuU7 wjRg766IGKSkU79xD3F/4AyEmmE6Blmr9Ygr/Q8ePkrFd8hkv6CSIPOqyLhZlFW+Wx k5a7HXaWGxtGfIbPuBsmL20LQBkWIydz3pRaa5/VHWyUdDpqO8hLDPUxdHdqFHPycE xm45DHLsUgVt0FWO7/zsVGcj8T7j06jqzgEgPLZcmnxiwQcfW+TLLwpT+xPIi/PyVM VJ3FOuyA3atIQ== Received: from localhost (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 86BB217E379E; Wed, 02 Dec 2026 03:20:26 +0100 (CET) From: Cristian Ciocaltea Date: Wed, 02 Dec 2026 04:20:05 +0200 Subject: [PATCH v2 11/25] drm/connector: Use the SPD InfoFrame field length defines X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261202-drm-conn-hdmi-cleanup-v2-11-ba7d32550ea4@collabora.com> References: <20261202-drm-conn-hdmi-cleanup-v2-0-ba7d32550ea4@collabora.com> In-Reply-To: <20261202-drm-conn-hdmi-cleanup-v2-0-ba7d32550ea4@collabora.com> To: Helge Deller , Thomas Zimmermann , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , David Airlie , Simona Vetter Cc: kernel@collabora.com, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?utf-8?q?Robin_R=C3=A4ber?= , Igor Paunovic X-Mailer: b4 0.15.2 DRM_CONNECTOR_HDMI_{VENDOR,PRODUCT}_LEN used to size the vendor and product arrays in struct drm_connector_hdmi. Those arrays are gone and both names are now only validated before being copied into the SPD InfoFrame, hence the limits they have to be checked against are the ones of the SPD InfoFrame fields themselves. Switch the remaining users over to HDMI_SPD_INFOFRAME_{VENDOR,PRODUCT}_LEN and drop the DRM specific defines, so that the two cannot drift apart. Reviewed-by: Maxime Ripard Tested-by: Robin Räber Tested-by: Igor Paunovic # RK3588 Orange Pi 5 Plus, dual HDMI Signed-off-by: Cristian Ciocaltea --- drivers/gpu/drm/drm_connector.c | 4 ++-- drivers/gpu/drm/tests/drm_connector_test.c | 13 +++++++------ include/drm/drm_connector.h | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 3fda52515b33..dcae52317046 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -579,8 +579,8 @@ int drmm_connector_hdmi_init(struct drm_device *dev, if (!hdmi_funcs->vendor || !hdmi_funcs->product) return -EINVAL; - if ((strlen(hdmi_funcs->vendor) > DRM_CONNECTOR_HDMI_VENDOR_LEN) || - (strlen(hdmi_funcs->product) > DRM_CONNECTOR_HDMI_PRODUCT_LEN)) + if ((strlen(hdmi_funcs->vendor) > HDMI_SPD_INFOFRAME_VENDOR_LEN) || + (strlen(hdmi_funcs->product) > HDMI_SPD_INFOFRAME_PRODUCT_LEN)) return -EINVAL; if (!hdmi_funcs->supported_formats || diff --git a/drivers/gpu/drm/tests/drm_connector_test.c b/drivers/gpu/drm/tests/drm_connector_test.c index d98c6a42ccae..591557c4a8bb 100644 --- a/drivers/gpu/drm/tests/drm_connector_test.c +++ b/drivers/gpu/drm/tests/drm_connector_test.c @@ -771,7 +771,7 @@ static void drm_test_connector_hdmi_init_product_valid(struct kunit *test) priv->hdmi_funcs.product = "Prod"; KUNIT_ASSERT_LT(test, strlen(priv->hdmi_funcs.product), - DRM_CONNECTOR_HDMI_PRODUCT_LEN); + HDMI_SPD_INFOFRAME_PRODUCT_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, @@ -794,7 +794,7 @@ static void drm_test_connector_hdmi_init_product_length_exact(struct kunit *test priv->hdmi_funcs.product = "ProductProductPr"; KUNIT_ASSERT_EQ(test, strlen(priv->hdmi_funcs.product), - DRM_CONNECTOR_HDMI_PRODUCT_LEN); + HDMI_SPD_INFOFRAME_PRODUCT_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, @@ -817,7 +817,7 @@ static void drm_test_connector_hdmi_init_product_length_too_long(struct kunit *t priv->hdmi_funcs.product = "ProductProductProduct"; KUNIT_ASSERT_GT(test, strlen(priv->hdmi_funcs.product), - DRM_CONNECTOR_HDMI_PRODUCT_LEN); + HDMI_SPD_INFOFRAME_PRODUCT_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, @@ -840,7 +840,7 @@ static void drm_test_connector_hdmi_init_vendor_valid(struct kunit *test) priv->hdmi_funcs.vendor = "Vend"; KUNIT_ASSERT_LT(test, strlen(priv->hdmi_funcs.vendor), - DRM_CONNECTOR_HDMI_VENDOR_LEN); + HDMI_SPD_INFOFRAME_VENDOR_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, @@ -863,7 +863,7 @@ static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) priv->hdmi_funcs.vendor = "VendorVe"; KUNIT_ASSERT_EQ(test, strlen(priv->hdmi_funcs.vendor), - DRM_CONNECTOR_HDMI_VENDOR_LEN); + HDMI_SPD_INFOFRAME_VENDOR_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, @@ -884,7 +884,8 @@ static void drm_test_connector_hdmi_init_vendor_length_too_long(struct kunit *te priv->hdmi_funcs = dummy_hdmi_funcs; priv->hdmi_funcs.vendor = "VendorVendor"; - KUNIT_ASSERT_GT(test, strlen(priv->hdmi_funcs.vendor), DRM_CONNECTOR_HDMI_VENDOR_LEN); + KUNIT_ASSERT_GT(test, strlen(priv->hdmi_funcs.vendor), + HDMI_SPD_INFOFRAME_VENDOR_LEN); ret = drmm_connector_hdmi_init(&priv->drm, &priv->connector, &dummy_funcs, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 2d4890dc585a..ffdb3c6dc6d3 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1485,15 +1485,15 @@ struct drm_connector_infoframe_funcs { * and controller capabilities */ struct drm_connector_hdmi_funcs { -#define DRM_CONNECTOR_HDMI_VENDOR_LEN 8 /** - * @vendor: HDMI Controller Vendor name. + * @vendor: HDMI Controller Vendor name, at most + * HDMI_SPD_INFOFRAME_VENDOR_LEN characters long. */ const char *vendor; -#define DRM_CONNECTOR_HDMI_PRODUCT_LEN 16 /** - * @product: HDMI Controller Product name + * @product: HDMI Controller Product name, at most + * HDMI_SPD_INFOFRAME_PRODUCT_LEN characters long. */ const char *product; -- 2.56.0