[PATCH v11 73/74] drm/connector: Use the SPD InfoFrame field length defines
Cristian Ciocaltea
cristian.ciocaltea at collabora.com
Tue Sep 1 11:51:37 PDT 2026
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.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea at collabora.com>
---
drivers/gpu/drm/drm_connector.c | 4 ++--
drivers/gpu/drm/tests/drm_connector_test.c | 12 ++++++------
include/drm/drm_connector.h | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index bb02e8626c0d..4bb43ac50b0a 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 be2d24abeeb8..f79cea11d161 100644
--- a/drivers/gpu/drm/tests/drm_connector_test.c
+++ b/drivers/gpu/drm/tests/drm_connector_test.c
@@ -782,7 +782,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,
@@ -805,7 +805,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,
@@ -828,7 +828,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,
@@ -851,7 +851,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,
@@ -874,7 +874,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,
@@ -895,7 +895,7 @@ 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 3b49799d12fd..2a804d42d4b1 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.55.0
More information about the linux-arm-kernel
mailing list