public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
To: "Boris Brezillon" <boris.brezillon@free-electrons.com>,
	"David Airlie" <airlied@linux.ie>,
	"Jianwei Wang" <jianwei.wang.chn@gmail.com>,
	"Alison Wang" <alison.wang@freescale.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Terje Bergström" <tbergstrom@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: do not use device name as a format string
Date: Sat, 5 Dec 2015 10:45:50 +0100	[thread overview]
Message-ID: <5662B24E.4090202@m4x.org> (raw)
In-Reply-To: <1447869498-13277-1-git-send-email-nicolas.iooss_linux@m4x.org>

Hello,
I sent the path below a few weeks ago and did not have any feedback.
Is there any issue in it that I need to fix before submitting it again?

Thanks,
Nicolas Iooss

On 11/18/2015 06:58 PM, Nicolas Iooss wrote:
> drm_dev_set_unique() formats its parameter using kvasprintf() but many
> of its callers directly pass dev_name(dev) as printf format string,
> without any format parameter.  This can cause some issues when the
> device name contains '%' characters.
> 
> To avoid any potential issue, always use "%s" when using
> drm_dev_set_unique() with dev_name().
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 2 +-
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c    | 2 +-
>  drivers/gpu/drm/tegra/drm.c                  | 2 +-
>  drivers/gpu/drm/vc4/vc4_drv.c                | 2 +-
>  include/drm/drmP.h                           | 1 +
>  5 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 244df0a440b7..0d720d3a7ee0 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -733,7 +733,7 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
>  	if (!ddev)
>  		return -ENOMEM;
>  
> -	ret = drm_dev_set_unique(ddev, dev_name(ddev->dev));
> +	ret = drm_dev_set_unique(ddev, "%s", dev_name(ddev->dev));
>  	if (ret)
>  		goto err_unref;
>  
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 1930234ba5f1..947d75f59881 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -363,7 +363,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
>  	fsl_dev->np = dev->of_node;
>  	drm->dev_private = fsl_dev;
>  	dev_set_drvdata(dev, fsl_dev);
> -	drm_dev_set_unique(drm, dev_name(dev));
> +	drm_dev_set_unique(drm, "%s", dev_name(dev));
>  
>  	ret = drm_dev_register(drm, 0);
>  	if (ret < 0)
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 159ef515cab1..b278f60f4376 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -991,7 +991,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
>  	if (!drm)
>  		return -ENOMEM;
>  
> -	drm_dev_set_unique(drm, dev_name(&dev->dev));
> +	drm_dev_set_unique(drm, "%s", dev_name(&dev->dev));
>  	dev_set_drvdata(&dev->dev, drm);
>  
>  	err = drm_dev_register(drm, 0);
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 6e730605edcc..c90a451aaa79 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -168,7 +168,7 @@ static int vc4_drm_bind(struct device *dev)
>  	vc4->dev = drm;
>  	drm->dev_private = vc4;
>  
> -	drm_dev_set_unique(drm, dev_name(dev));
> +	drm_dev_set_unique(drm, "%s", dev_name(dev));
>  
>  	drm_mode_config_init(drm);
>  	if (ret)
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 0b921ae06cd8..995fb96cb740 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1049,6 +1049,7 @@ void drm_dev_ref(struct drm_device *dev);
>  void drm_dev_unref(struct drm_device *dev);
>  int drm_dev_register(struct drm_device *dev, unsigned long flags);
>  void drm_dev_unregister(struct drm_device *dev);
> +__printf(2, 3)
>  int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...);
>  
>  struct drm_minor *drm_minor_acquire(unsigned int minor_id);
> 


  reply	other threads:[~2015-12-05  9:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 17:58 [PATCH] drm: do not use device name as a format string Nicolas Iooss
2015-12-05  9:45 ` Nicolas Iooss [this message]
2015-12-06  9:35   ` Daniel Vetter
2015-12-06 10:16     ` Nicolas Iooss
2015-12-07  7:43       ` Daniel Vetter
2015-12-07  9:53         ` Jani Nikula
2015-12-07 11:46           ` Daniel Vetter
2015-12-07 12:31             ` Thierry Reding
2015-12-07 17:25               ` Nicolas Iooss
2015-12-07 12:25 ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5662B24E.4090202@m4x.org \
    --to=nicolas.iooss_linux@m4x.org \
    --cc=airlied@linux.ie \
    --cc=alison.wang@freescale.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jianwei.wang.chn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=tbergstrom@nvidia.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox