lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240818-amdgpu-drm_edid-v1-10-aea66c1f7cf4@weissschuh.net>
Date: Sun, 18 Aug 2024 12:43:34 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>, 
 Rodrigo Siqueira <Rodrigo.Siqueira@....com>, 
 Alex Deucher <alexander.deucher@....com>, 
 Christian König <christian.koenig@....com>, 
 Xinhui Pan <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>, 
 Daniel Vetter <daniel@...ll.ch>, jinzh <jinzh@...hub.amd.com>, 
 Aric Cyr <Aric.Cyr@....com>, Alan Liu <HaoPing.Liu@....com>, 
 Tony Cheng <Tony.Cheng@....com>, 
 Andrey Grodzovsky <Andrey.Grodzovsky@....com>, 
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, 
 linux-kernel@...r.kernel.org, Harry Wentland <Harry.Wentland@....com>, 
 Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 10/12] drm/edid: add a helper to compare two EDIDs

As struct drm_edid is opaque, drivers can't directly memcmp() the
contained data. Add a helper to provide this functionality.

Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++
 include/drm/drm_edid.h     |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 69fb11741abd..c2493c983a64 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1840,6 +1840,24 @@ static bool drm_edid_eq(const struct drm_edid *drm_edid,
 	return true;
 }
 
+/**
+ * drm_edid_equal - compare two EDID
+ * @drm_edid_a: First EDID data
+ * @drm_edid_b: Second EDID data
+ *
+ * Compare two EDIDs for equality (including extensions)
+ *
+ * Return: True if the EDIDs are equal, false otherwise.
+ */
+bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b)
+{
+	if (!drm_edid_b)
+		return !drm_edid_a;
+
+	return drm_edid_eq(drm_edid_a, drm_edid_b->edid, drm_edid_b->size);
+}
+EXPORT_SYMBOL(drm_edid_equal);
+
 enum edid_block_status {
 	EDID_BLOCK_OK = 0,
 	EDID_BLOCK_READ_FAIL,
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index a5b377c4a342..35b40a9d3350 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -456,6 +456,7 @@ drm_display_mode_from_cea_vic(struct drm_device *dev,
 const struct drm_edid *drm_edid_alloc(const void *edid, size_t size);
 const struct drm_edid *drm_edid_dup(const struct drm_edid *drm_edid);
 void drm_edid_free(const struct drm_edid *drm_edid);
+bool drm_edid_equal(const struct drm_edid *drm_edid_a, const struct drm_edid *drm_edid_b);
 bool drm_edid_valid(const struct drm_edid *drm_edid);
 const struct edid *drm_edid_raw(const struct drm_edid *drm_edid);
 const struct drm_edid *drm_edid_read(struct drm_connector *connector);

-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ