Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752800AbbLFJgJ (ORCPT ); Sun, 6 Dec 2015 04:36:09 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35402 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbbLFJgE (ORCPT ); Sun, 6 Dec 2015 04:36:04 -0500 Date: Sun, 6 Dec 2015 10:35:59 +0100 From: Daniel Vetter To: Nicolas Iooss Cc: Boris Brezillon , David Airlie , Jianwei Wang , Alison Wang , Thierry Reding , Terje =?iso-8859-1?Q?Bergstr=F6m?= , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm: do not use device name as a format string Message-ID: <20151206093559.GT10243@phenom.ffwll.local> Mail-Followup-To: Nicolas Iooss , Boris Brezillon , David Airlie , Jianwei Wang , Alison Wang , Thierry Reding , Terje =?iso-8859-1?Q?Bergstr=F6m?= , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1447869498-13277-1-git-send-email-nicolas.iooss_linux@m4x.org> <5662B24E.4090202@m4x.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5662B24E.4090202@m4x.org> X-Operating-System: Linux phenom 4.1.0-2-amd64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4652 Lines: 119 On Sat, Dec 05, 2015 at 10:45:50AM +0100, Nicolas Iooss wrote: > 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? Sorry, must have missed this. > > 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(). Not sure this is worth it really, normally people don't place % characters into their device names, ever. And if they do it'll blow up. There's also no security issue here since userspace can't set this name. If the maintainers of the affected drivers don't want this I won't merge this patch. Thanks, Daniel > > > > Signed-off-by: Nicolas Iooss > > --- > > 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); > > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/