drm/displayid: add displayid_get_header() and check bounds better
authorJani Nikula <jani.nikula@intel.com>
Thu, 16 Feb 2023 20:44:58 +0000 (22:44 +0200)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Sun, 26 Feb 2023 23:58:37 +0000 (02:58 +0300)
commit5bacecc3c56131c31f18b23d366f2184328fd9cf
tree87fc3f9fd7ac7cc8a381b2d29b65a9132d9ed0a2
parent25c0e4062db43b790fbecf14d7cce6fc75fb3b26
drm/displayid: add displayid_get_header() and check bounds better

Add a helper to get a pointer to struct displayid_header. To be
pedantic, add buffer overflow checks to not touch the base if that
itself would overflow.

Cc: Iaroslav Boliukin <iam@lach.pw>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4a03b3a5132642d3cdb6d4c2641422955a917292.1676580180.git.jani.nikula@intel.com
drivers/gpu/drm/drm_displayid.c