On 6 March 2018 at 13:54, Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > On Tue, Mar 06, 2018 at 01:35:11PM +0000, Emil Velikov wrote: >> Hi Ville, >> >> On 2 March 2018 at 13:25, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: >> > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> >> > >> > Creating a property that doesn't have a name makes no sense to me. Don't >> > allow it. >> > >> > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> >> > --- >> > drivers/gpu/drm/drm_property.c | 6 ++---- >> > 1 file changed, 2 insertions(+), 4 deletions(-) >> > >> > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c >> > index bae50e6b819d..fe8627fb7ae6 100644 >> > --- a/drivers/gpu/drm/drm_property.c >> > +++ b/drivers/gpu/drm/drm_property.c >> > @@ -99,10 +99,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, >> > property->num_values = num_values; >> > INIT_LIST_HEAD(&property->enum_list); >> > >> > - if (name) { >> > - strncpy(property->name, name, DRM_PROP_NAME_LEN); >> > - property->name[DRM_PROP_NAME_LEN-1] = '\0'; >> > - } >> > + strncpy(property->name, name, DRM_PROP_NAME_LEN); >> > + property->name[DRM_PROP_NAME_LEN-1] = '\0'; >> > >> Shouldn't one also a) error (WARN + return NULL) out when name is NULL >> and b) update the documentation? > > The developer gets the oops. No point in further handholding IMO. > Gut feeling suggests that not everyone tests all their drm_properly_create codepaths. So it's more of user gets an oops. But that's another story ;-) > Didn't look at the docs us usual. Are they saying NULL is OK? > The drm_property_create does not explicitly mention (allow?) NULL. Yet again I don't recall any instances of the docs saying that, using NULL is allowed/valid. It's been a while since I read through the docs, so they might be updated. Either way it was a simple fly-by suggestion. -Emil _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel