[Intel-gfx] [PATCH 1/3] drm/i915/gvt: Set return value for ppgtt_populate error path

Ramalingam C ramalingam.c at intel.com
Fri May 17 13:10:04 UTC 2019


On 2019-05-17 at 18:31:42 +0530, Ramalingam C wrote:
> On 2019-05-17 at 11:22:23 +0100, Chris Wilson wrote:
> > Caught by smatch:
> > drivers/gpu/drm/i915//gvt/gtt.c:1106 ppgtt_populate_spt_by_guest_entry() error: uninitialized symbol 'ret'.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/gtt.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> > index 08c74e65836b..244ad1729764 100644
> > --- a/drivers/gpu/drm/i915/gvt/gtt.c
> > +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> > @@ -1076,8 +1076,10 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_spt_by_guest_entry(
> >  	} else {
> >  		int type = get_next_pt_type(we->type);
> >  
> > -		if (!gtt_type_is_pt(type))
> > +		if (!gtt_type_is_pt(type)) {
> > +			ret = -EINVAL;
> >  			goto err;
> > +		}
> 
> ret will be still uninitialized if we pass
> 	if (spt) {
> and not pass
> 	if (ips != spt->guest_page.pde_ips) {
relooking at it if we dont pass the "if (ips !=
spt->guest_page.pde_ips)" then there is no err exit.

So 

Reviewed-by: Ramalingam C <ramalingam.c at intel.com>

-Ram
> 
> -Ram
> >  
> >  		spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
> >  		if (IS_ERR(spt)) {
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list