Message ID | 20190403064407.25646-1-tvrtko.ursulin@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: Fix uninitialized mask in intel_device_info_subplatform_init | expand |
Quoting Tvrtko Ursulin (2019-04-03 07:44:07) > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Mask need to be initialized to zero since device id checks may not match. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Fixes: 805446c8347c ("drm/i915: Introduce concept of a sub-platform") > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Jani Nikula <jani.nikula@intel.com> > Cc: Lucas De Marchi <lucas.demarchi@intel.com> > Cc: Jose Souza <jose.souza@intel.com> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> > Cc: Jani Nikula <jani.nikula@linux.intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> > Cc: Dan Carpenter <dan.carpenter@oracle.com> Bots are doing a better job than me, but still Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> -Chris
On 03/04/2019 08:13, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2019-04-03 07:44:07) >> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> >> >> Mask need to be initialized to zero since device id checks may not match. >> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> >> Fixes: 805446c8347c ("drm/i915: Introduce concept of a sub-platform") >> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> >> Cc: Chris Wilson <chris@chris-wilson.co.uk> >> Cc: Jani Nikula <jani.nikula@intel.com> >> Cc: Lucas De Marchi <lucas.demarchi@intel.com> >> Cc: Jose Souza <jose.souza@intel.com> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> >> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> >> Cc: Jani Nikula <jani.nikula@linux.intel.com> >> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> >> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> >> Cc: Dan Carpenter <dan.carpenter@oracle.com> > > Bots are doing a better job than me, but still > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> It's my bad, probably introduced due various refactoring of the patch itself. Since I definitely remember changing the mask initialization back and forth. No huge harm done since caught quickly by this very valuable service provided by Dan. Regards, Tvrtko P.S. Also the assert about no junk in high bits did not fire in CI which would suggest stack slot was either zero or no more than three low bits sets. Strange luck.
On Wed, Apr 03, 2019 at 09:13:59AM +0100, Tvrtko Ursulin wrote: > P.S. Also the assert about no junk in high bits did not fire in CI which > would suggest stack slot was either zero or no more than three low bits > sets. Strange luck. GCC happens to initialize it to zero. It's also why GCC didn't trigger an uninialized variable warning. The bug was reported to GCC years ago. regards, dan carpenter
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 0ed49d032c00..6af480b95bc6 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -778,7 +778,7 @@ void intel_device_info_subplatform_init(struct drm_i915_private *i915) const unsigned int pi = __platform_mask_index(rinfo, info->platform); const unsigned int pb = __platform_mask_bit(rinfo, info->platform); u16 devid = INTEL_DEVID(i915); - u32 mask; + u32 mask = 0; /* Make sure IS_<platform> checks are working. */ RUNTIME_INFO(i915)->platform_mask[pi] = BIT(pb);