Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/edid: add drm_edid_raw() to access the raw EDID data

Unfortunately, there are still plenty of interfaces around that require
a struct edid pointer, and it's impossible to change them all at
once. Add an accessor to the raw EDID data to help the transition.

While there are no such cases now, be defensive against raw EDID
extension count indicating bigger EDID than is actually allocated.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/fb55d0b580d556bf2b8e58070239657ac9cb4b2f.1656494768.git.jani.nikula@intel.com

+27
+26
drivers/gpu/drm/drm_edid.c
··· 2359 2359 } 2360 2360 EXPORT_SYMBOL_GPL(drm_do_get_edid); 2361 2361 2362 + /** 2363 + * drm_edid_raw - Get a pointer to the raw EDID data. 2364 + * @drm_edid: drm_edid container 2365 + * 2366 + * Get a pointer to the raw EDID data. 2367 + * 2368 + * This is for transition only. Avoid using this like the plague. 2369 + * 2370 + * Return: Pointer to raw EDID data. 2371 + */ 2372 + const struct edid *drm_edid_raw(const struct drm_edid *drm_edid) 2373 + { 2374 + if (!drm_edid || !drm_edid->size) 2375 + return NULL; 2376 + 2377 + /* 2378 + * Do not return pointers where relying on EDID extension count would 2379 + * lead to buffer overflow. 2380 + */ 2381 + if (WARN_ON(edid_size(drm_edid->edid) > drm_edid->size)) 2382 + return NULL; 2383 + 2384 + return drm_edid->edid; 2385 + } 2386 + EXPORT_SYMBOL(drm_edid_raw); 2387 + 2362 2388 /* Allocate struct drm_edid container *without* duplicating the edid data */ 2363 2389 static const struct drm_edid *_drm_edid_alloc(const void *edid, size_t size) 2364 2390 {
+1
include/drm/drm_edid.h
··· 597 597 const struct drm_edid *drm_edid_alloc(const void *edid, size_t size); 598 598 const struct drm_edid *drm_edid_dup(const struct drm_edid *drm_edid); 599 599 void drm_edid_free(const struct drm_edid *drm_edid); 600 + const struct edid *drm_edid_raw(const struct drm_edid *drm_edid); 600 601 const struct drm_edid *drm_edid_read(struct drm_connector *connector); 601 602 const struct drm_edid *drm_edid_read_ddc(struct drm_connector *connector, 602 603 struct i2c_adapter *adapter);