[Intel-gfx] [PATCH] drm/i915: silence coverity warning
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 2 13:38:19 UTC 2017
Quoting Ville Syrjälä (2017-11-02 13:22:51)
> On Thu, Nov 02, 2017 at 12:06:27PM +0000, Chris Wilson wrote:
> > Quoting Lionel Landwerlin (2017-11-02 11:41:26)
> > > Because dev_priv is 0-ed it's not currently an issue, but since we
> > > have dev_priv->perf.oa.test_config.uuid size at uuid + 1, we could
> > > just copy the null character and silence this warning.
> >
> > It doesn't copy the nul over exactly, to be complete s/strncpy/strlcpy/
> > as well.
>
> Or just memcpy(), thugh maybe that'd be more dangerous if the size
> gets changed for some reasonn.
struct uuid { char [UUID_STRING_LEN+1]; }
test_config.uuid = (struct uuid) { "aaaa-bbbb-cccc-dddd" };
?
The compiler should then warn if it wants to about the string being the
wrong size; anything too short is nul-extended.
-Chris
More information about the Intel-gfx
mailing list