diff mbox series

drm: use "0" instead of "" for deprecated driver date

Message ID 20240510090951.3398882-1-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: use "0" instead of "" for deprecated driver date | expand

Commit Message

Jani Nikula May 10, 2024, 9:09 a.m. UTC
libdrm does not like the empty string for driver date. Use "0" instead,
which has been used by virtio previously.

Reported-by: Steven Price <steven.price@arm.com>
Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Javier Martinez Canillas May 10, 2024, 9:30 a.m. UTC | #1
Jani Nikula <jani.nikula@intel.com> writes:

> libdrm does not like the empty string for driver date. Use "0" instead,
> which has been used by virtio previously.
>
> Reported-by: Steven Price <steven.price@arm.com>
> Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
> Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---

It's a pity that libdrm can't cope with the empty string, using 0 makes sense.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Steven Price May 10, 2024, 9:36 a.m. UTC | #2
On 10/05/2024 10:09, Jani Nikula wrote:
> libdrm does not like the empty string for driver date. Use "0" instead,
> which has been used by virtio previously.
> 
> Reported-by: Steven Price <steven.price@arm.com>
> Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
> Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Tested-by: Steven Price <steven.price@arm.com>

Thanks,
Steve

> ---
>  drivers/gpu/drm/drm_ioctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 89feb7306e47..51f39912866f 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -530,9 +530,9 @@ int drm_version(struct drm_device *dev, void *data,
>  	err = drm_copy_field(version->name, &version->name_len,
>  			dev->driver->name);
>  
> -	/* Driver date is deprecated. Return the empty string. */
> +	/* Driver date is deprecated. Userspace expects a non-empty string. */
>  	if (!err)
> -		err = drm_copy_field(version->date, &version->date_len, "");
> +		err = drm_copy_field(version->date, &version->date_len, "0");
>  	if (!err)
>  		err = drm_copy_field(version->desc, &version->desc_len,
>  				dev->driver->desc);
Simon Ser May 10, 2024, 10:36 a.m. UTC | #3
Sounds good to me.

Reviewed-by: Simon Ser <contact@emersion.fr>
Ville Syrjälä May 10, 2024, 5:33 p.m. UTC | #4
On Fri, May 10, 2024 at 12:09:51PM +0300, Jani Nikula wrote:
> libdrm does not like the empty string for driver date. Use "0" instead,
> which has been used by virtio previously.
> 
> Reported-by: Steven Price <steven.price@arm.com>
> Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
> Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_ioctl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 89feb7306e47..51f39912866f 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -530,9 +530,9 @@ int drm_version(struct drm_device *dev, void *data,
>  	err = drm_copy_field(version->name, &version->name_len,
>  			dev->driver->name);
>  
> -	/* Driver date is deprecated. Return the empty string. */
> +	/* Driver date is deprecated. Userspace expects a non-empty string. */
>  	if (!err)
> -		err = drm_copy_field(version->date, &version->date_len, "");
> +		err = drm_copy_field(version->date, &version->date_len, "0");

Does this also fix igt/core_getversion which is on fire now?

>  	if (!err)
>  		err = drm_copy_field(version->desc, &version->desc_len,
>  				dev->driver->desc);
> -- 
> 2.39.2
Ville Syrjälä May 10, 2024, 5:59 p.m. UTC | #5
On Fri, May 10, 2024 at 08:33:59PM +0300, Ville Syrjälä wrote:
> On Fri, May 10, 2024 at 12:09:51PM +0300, Jani Nikula wrote:
> > libdrm does not like the empty string for driver date. Use "0" instead,
> > which has been used by virtio previously.
> > 
> > Reported-by: Steven Price <steven.price@arm.com>
> > Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
> > Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> > ---
> >  drivers/gpu/drm/drm_ioctl.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> > index 89feb7306e47..51f39912866f 100644
> > --- a/drivers/gpu/drm/drm_ioctl.c
> > +++ b/drivers/gpu/drm/drm_ioctl.c
> > @@ -530,9 +530,9 @@ int drm_version(struct drm_device *dev, void *data,
> >  	err = drm_copy_field(version->name, &version->name_len,
> >  			dev->driver->name);
> >  
> > -	/* Driver date is deprecated. Return the empty string. */
> > +	/* Driver date is deprecated. Userspace expects a non-empty string. */
> >  	if (!err)
> > -		err = drm_copy_field(version->date, &version->date_len, "");
> > +		err = drm_copy_field(version->date, &version->date_len, "0");
> 
> Does this also fix igt/core_getversion which is on fire now?

At least it fixes Xorg which currently just segfaults.

Pushed to drm-misc-next. Thanks everyone.

> 
> >  	if (!err)
> >  		err = drm_copy_field(version->desc, &version->desc_len,
> >  				dev->driver->desc);
> > -- 
> > 2.39.2
> 
> -- 
> Ville Syrjälä
> Intel
Jani Nikula May 13, 2024, 7:46 a.m. UTC | #6
On Fri, 10 May 2024, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Fri, May 10, 2024 at 08:33:59PM +0300, Ville Syrjälä wrote:
>> On Fri, May 10, 2024 at 12:09:51PM +0300, Jani Nikula wrote:
>> > libdrm does not like the empty string for driver date. Use "0" instead,
>> > which has been used by virtio previously.
>> > 
>> > Reported-by: Steven Price <steven.price@arm.com>
>> > Closes: https://lore.kernel.org/r/9d0cff47-308e-4b11-a9f3-4157dc26b6fa@arm.com
>> > Fixes: 7fb8af6798e8 ("drm: deprecate driver date")
>> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> > ---
>> >  drivers/gpu/drm/drm_ioctl.c | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> > 
>> > diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
>> > index 89feb7306e47..51f39912866f 100644
>> > --- a/drivers/gpu/drm/drm_ioctl.c
>> > +++ b/drivers/gpu/drm/drm_ioctl.c
>> > @@ -530,9 +530,9 @@ int drm_version(struct drm_device *dev, void *data,
>> >  	err = drm_copy_field(version->name, &version->name_len,
>> >  			dev->driver->name);
>> >  
>> > -	/* Driver date is deprecated. Return the empty string. */
>> > +	/* Driver date is deprecated. Userspace expects a non-empty string. */
>> >  	if (!err)
>> > -		err = drm_copy_field(version->date, &version->date_len, "");
>> > +		err = drm_copy_field(version->date, &version->date_len, "0");
>> 
>> Does this also fix igt/core_getversion which is on fire now?
>
> At least it fixes Xorg which currently just segfaults.
>
> Pushed to drm-misc-next. Thanks everyone.

Thanks, and sorry.

BR,
Jani.

>
>> 
>> >  	if (!err)
>> >  		err = drm_copy_field(version->desc, &version->desc_len,
>> >  				dev->driver->desc);
>> > -- 
>> > 2.39.2
>> 
>> -- 
>> Ville Syrjälä
>> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 89feb7306e47..51f39912866f 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -530,9 +530,9 @@  int drm_version(struct drm_device *dev, void *data,
 	err = drm_copy_field(version->name, &version->name_len,
 			dev->driver->name);
 
-	/* Driver date is deprecated. Return the empty string. */
+	/* Driver date is deprecated. Userspace expects a non-empty string. */
 	if (!err)
-		err = drm_copy_field(version->date, &version->date_len, "");
+		err = drm_copy_field(version->date, &version->date_len, "0");
 	if (!err)
 		err = drm_copy_field(version->desc, &version->desc_len,
 				dev->driver->desc);