Re: [PATCH] drm/i915/kvmgt: avoid dereferencing a potentially null info pointer

From: Chris Wilson
Date: Thu Mar 23 2017 - 08:39:16 EST


On Thu, Mar 23, 2017 at 12:22:30PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre