lkml.org 
[lkml]   [2021]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][next] drm/i915: Fix dereference of pointer backup before it is null checked
On Tue, Oct 12, 2021 at 04:47:24PM +0200, Thomas Hellström wrote:
> Hi,
>
> On 10/12/21 15:25, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The assignment of pointer backup_bo dereferences pointer backup before
> > backup is null checked, this could lead to a null pointer dereference
> > issue. Fix this by only assigning backup_bo after backup has been null
> > checked.
> >
> > Addresses-Coverity: ("Dereference before null check")
> > Fixes: c56ce9565374 ("drm/i915 Implement LMEM backup and restore for suspend / resume")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> There's not really a pointer dereference here, just pointer arithmetics, so
> the code should be safe (but admittedly fragile), so to keep Coverity happy,
>
> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>

Yeah. I kind of feel like we shouldn't work around static checker bugs.
But when we do then there shouldn't be a Fixes tag.

regards,
dan carpenter

\
 
 \ /
  Last update: 2021-10-12 17:13    [W:0.036 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site