[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202112031627.C312CCDD0@keescook>
Date: Fri, 3 Dec 2021 16:30:12 -0800
From: Kees Cook <keescook@...omium.org>
To: Thierry Reding <treding@...dia.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Ville Syrjälä
<ville.syrjala@...ux.intel.com>, Imre Deak <imre.deak@...el.com>,
Uma Shankar <uma.shankar@...el.com>,
Manasi Navare <manasi.d.navare@...el.com>,
Ankit Nautiyal <ankit.k.nautiyal@...el.com>,
José Roberto de Souza
<jose.souza@...el.com>, Philipp Zabel <p.zabel@...gutronix.de>,
Lyude Paul <lyude@...hat.com>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] drm/dp: Actually read Adjust Request Post Cursor2
register
On Fri, Dec 03, 2021 at 04:28:56PM +0100, Thierry Reding wrote:
> On Fri, Dec 03, 2021 at 01:25:17AM -0800, Kees Cook wrote:
> > The link_status array was not large enough to read the Adjust Request
> > Post Cursor2 register. Adjust the size to include it. Found with a
> > -Warray-bounds build:
> >
> > drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
> > drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds]
> > 59 | return link_status[r - DP_LANE0_1_STATUS];
> > | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status'
> > 147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
> > | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")
> > Signed-off-by: Kees Cook <keescook@...omium.org>
> > ---
> > v2: Fix missed array size change in intel_dp_check_mst_status()
> > ---
> > drivers/gpu/drm/i915/display/intel_dp.c | 8 ++++----
> > include/drm/drm_dp_helper.h | 10 +++++++++-
> > 2 files changed, 13 insertions(+), 5 deletions(-)
>
> This sounds very familiar and I vaguely recall typing up a patch like
> that a long time ago. But I obviously failed because that never seems
> to have made it upstream.
>
> Or perhaps I'm misremembering and was thinking about this instead:
>
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/338590/
Oh! Yeah, that's the same thing. Looks like that never made its way
upstream. :(
>
> Bonus points for adding that comment with background information on why
> we need this.
Thanks! Yeah, I needed to really convince myself everything added up and
made sense, and figured I should try to capture that research. ;)
> Reviewed-by: Thierry Reding <treding@...dia.com>
Thanks!
-Kees
--
Kees Cook
Powered by blists - more mailing lists