Re: [PATCH v2] drm/i915: Initialize the mbus_offset to fix static analysis issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 04, 2021 at 06:22:49PM +0300, Mika Kuoppala wrote:
> Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> writes:
> 
> > On Thu, Jun 03, 2021 at 03:07:54PM -0700, Manasi Navare wrote:
> >> Static analysis identified an issue in skl_crtc_allocate_ddb where
> >> mbus_offset may be used uninitialized.
> >> This patch fixes it.
> >
> > I'm sorry, but I really cannot see what this tool is seeing...
> > I even tried to look to our internal branch to see if it was an issue
> > there.
> > But I'm failing to see how it is possible...
> 
> It is in the goto out; path.

indeed... thanks

what a huge "out" block.

For me it looks like another function and not just an "out".

Could we get a refactor here?
I'm afraid that setting mbus_offset = 0 silence the static analysis tool,
but this might not be right for this "out" section. Because offset gets
totally ignored.

The condition to call the goto out is not that clear on why we want
one or another path, so a refactor there to make things more clear is
probably the best.

> -Mika
> 
> >
> >> 
> >> Fixes: 835c176cb1c4 ("drm/i915: Introduce MBUS relative dbuf offsets")
> >> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> >> Signed-off-by: Manasi Navare <manasi.d.navare@xxxxxxxxx>
> >> ---
> >>  drivers/gpu/drm/i915/intel_pm.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> >> index 00f3dead20ad..a385b8b7414f 100644
> >> --- a/drivers/gpu/drm/i915/intel_pm.c
> >> +++ b/drivers/gpu/drm/i915/intel_pm.c
> >> @@ -4163,7 +4163,7 @@ skl_crtc_allocate_ddb(struct intel_atomic_state *state, struct intel_crtc *crtc)
> >>  	struct intel_crtc_state *crtc_state;
> >>  	struct skl_ddb_entry ddb_slices;
> >>  	enum pipe pipe = crtc->pipe;
> >> -	unsigned int mbus_offset;
> >> +	unsigned int mbus_offset = 0;
> >>  	u32 ddb_range_size;
> >>  	u32 dbuf_slice_mask;
> >>  	u32 start, end;
> >> -- 
> >> 2.19.1
> >> 
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> >> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux