Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbbLHXxF (ORCPT ); Tue, 8 Dec 2015 18:53:05 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34826 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbbLHXxC (ORCPT ); Tue, 8 Dec 2015 18:53:02 -0500 Subject: Re: [PATCH 1/2] drm: make drm_dev_set_unique() not use a format string To: Emil Velikov References: <1449612732-32438-1-git-send-email-nicolas.iooss_linux@m4x.org> Cc: Boris Brezillon , David Airlie , Jianwei Wang , Alison Wang , Mark Yao , Thierry Reding , =?UTF-8?Q?Terje_Bergstr=c3=b6m?= , Stephen Warren , ML dri-devel , linux-tegra@vger.kernel.org, "Linux-Kernel@Vger. Kernel. Org" From: Nicolas Iooss Message-ID: <56676D5A.6060605@m4x.org> Date: Wed, 9 Dec 2015 00:52:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2410 Lines: 52 On 12/09/2015 12:28 AM, Emil Velikov wrote: > On 8 December 2015 at 22:12, Nicolas Iooss wrote: >> drm_dev_set_unique() uses a format string to define the unique name of a >> device. This feature is not used as currently all the calls to this >> function either use "%s" as a format string or directly use >> dev_name(). >> >> Even though this second kind of call does not introduce security >> problems, because there cannot be "%" characters in dev_name() results, >> gcc issues a warning when building with -Wformat-security flag >> ("warning: format string is not a string literal (potentially >> insecure)"). This warning is useful to find real bugs like the one >> fixed by commit 3958b79266b1 ("configfs: fix kernel infoleak through >> user-controlled format string"). False positives which do not bring >> an extra value make the work of finding real bugs harder. >> >> Therefore remove the format-string feature from drm_dev_set_unique(). >> >> Signed-off-by: Nicolas Iooss >> --- >> drivers/gpu/drm/drm_drv.c | 11 +++-------- >> drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- >> include/drm/drmP.h | 2 +- >> 4 files changed, 6 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c >> index 7dd6728dd092..20eaa0aae205 100644 >> --- a/drivers/gpu/drm/drm_drv.c >> +++ b/drivers/gpu/drm/drm_drv.c >> @@ -797,7 +797,7 @@ EXPORT_SYMBOL(drm_dev_unregister); >> /** >> * drm_dev_set_unique - Set the unique name of a DRM device >> * @dev: device of which to set the unique name >> - * @fmt: format string for unique name >> + * @name: unique name >> * >> * Sets the unique name of a DRM device using the specified format string and >> * a variable list of arguments. Drivers can use this at driver probe time if > You might want to also update the above hunk :-) Indeed, thanks! I will wait a little bit for other feedbacks, read all the comments/documentation to see if anything else needs an update and submit a v2. Nicolas -- 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/