All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Colin King <colin.king@canonical.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Matthew Auld <matthew.auld@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH][next] drm/i915: Fix dereference of pointer backup before it is null checked
Date: Tue, 12 Oct 2021 18:12:18 +0300	[thread overview]
Message-ID: <20211012151218.GF8429@kadam> (raw)
In-Reply-To: <c49654d9-7174-f6db-e64b-bec3ecde7b5c@linux.intel.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Colin King <colin.king@canonical.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Matthew Auld <matthew.auld@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] drm/i915: Fix dereference of pointer backup before it is null checked
Date: Tue, 12 Oct 2021 18:12:18 +0300	[thread overview]
Message-ID: <20211012151218.GF8429@kadam> (raw)
In-Reply-To: <c49654d9-7174-f6db-e64b-bec3ecde7b5c@linux.intel.com>

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


  reply	other threads:[~2021-10-12 15:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 13:25 [Intel-gfx] [PATCH][next] drm/i915: Fix dereference of pointer backup before it is null checked Colin King
2021-10-12 13:25 ` Colin King
2021-10-12 14:17 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-10-12 14:47 ` [Intel-gfx] [PATCH][next] " Thomas Hellström
2021-10-12 14:47   ` Thomas Hellström
2021-10-12 15:12   ` Dan Carpenter [this message]
2021-10-12 15:12     ` Dan Carpenter
2021-10-12 19:18 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211012151218.GF8429@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=colin.king@canonical.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.