[Intel-gfx] [PATCH] drm/i915/kvmgt: avoid dereferencing a potentially null info pointer

Zhenyu Wang zhenyuw at linux.intel.com
Fri Mar 24 03:06:15 UTC 2017


On 2017.03.23 16:11:00 +0200, Joonas Lahtinen wrote:
> Dropping the irrelevant Cc's.
> 
> On to, 2017-03-23 at 12:39 +0000, Chris Wilson wrote:
> > On Thu, Mar 23, 2017 at 12:22:30PM +0000, Colin King wrote:
> > > 
> > > From: Colin Ian King <colin.king at canonical.com>
> > > 
> > > info is being checked to see if it is a null pointer, however, vpgu is
> > > dereferencing info before this check, leading to a potential null
> > > pointer dereference.  If info is null, then the error message being
> > > printed by macro gvt_vgpu_err and this requires vpgu to exist. We can
> > > use a null vpgu as the macro has a sanity check to see if vpgu is null,
> > > so this is OK.
> >
> > It is never NULL, it gets checked by its only caller.
> 
> Took me a while to make any sense of the code as gvt_vgpu_err depends
> on a vgpu variable being declared in the scope without taking it as a
> parameter and that is a one big no-no:
> 
> https://01.org/linuxgraphics/gfx-docs/drm/process/coding-style.html#macros-enums-and-rtl
> 

Thanks for comment, Joonas. Current gvt dbg print is still a mess,
we will try to clean it up.

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20170324/9279a1ae/attachment.sig>


More information about the Intel-gfx mailing list