Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp316737pxu; Fri, 23 Oct 2020 01:12:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl1NUXK0zhD9GwsgwlHqMNF6eoqWCjxSQ0pvbvzC5RcqJynK3X3lCZy9KlDq2BpTF1RC1+ X-Received: by 2002:aa7:d992:: with SMTP id u18mr1062895eds.284.1603440760598; Fri, 23 Oct 2020 01:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603440760; cv=none; d=google.com; s=arc-20160816; b=KBZb8c8+t7lKBgYK5PR3BOoHhY3a2oqBwzTP9mVsbDxVs9NMgmuQZOYsalTwF7Q61U 8hoiwowpKjYQcZYfrXxg90zqaZ5UmGKKY4cQ8GixfXg6SGf44rUbmYzlb7ZTAYaohhru pt5XfGnNVQ8l5j0X59S732Vdf5hLeDB7f4kVsGNDjqNuMTzeuUIYJ43Qr9ZCVu/BjUwb hpWEFU9XPMFYEIaVuDmxRClPmOSqNAXOFTqMaecAmr7ajitkVbNT06o2kMDHkL9LbYeU wDz1ER0/F0xgsJ9NHOnPcvcp3aLSKZMJqLVwonmJrqH5kM57tr4CkLNYI2A1oioZ0rU3 5+Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RUcxisLOxCI3BoSNmZD+/diRt/d48rmt+1vilvcj3gs=; b=JiQ5h5QSfCUgAHnMpC/NlpeA3kVXOukuEWaiIMtoALE4Y4Tn6FgDlbWi+f7QnoVRo+ pAwLhNgunxvWL6XaPDEQYi1eiSYdXTBzNKlAXMjxA5jZ9SlZMeDMpvHNVhfqMcOANw3U /wGn8ib/xkZygmQpG4ng0VMrsJXJKCjUkZZ0FMFJe4cpxMZIM6Tu5z/4OetanNixc5FK L/8z8elhA6AE4z9qMhMCmIkAONz3jIT5Fn9iDEfSKjs+uRVwkV0wBKknvYJzwTw7f3DO KkNDSGsz4huJ0XylsPGf0hg78d8NLZV2JPbOV8IL0AU4syCDOwWVZPq2atjg4HcVCQ9x 8KSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o24si375961eje.62.2020.10.23.01.12.18; Fri, 23 Oct 2020 01:12:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S375647AbgJWHPI (ORCPT + 99 others); Fri, 23 Oct 2020 03:15:08 -0400 Received: from verein.lst.de ([213.95.11.211]:55002 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373936AbgJWHPI (ORCPT ); Fri, 23 Oct 2020 03:15:08 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 41E1667373; Fri, 23 Oct 2020 09:15:04 +0200 (CEST) Date: Fri, 23 Oct 2020 09:15:03 +0200 From: Christoph Hellwig To: Nick Desaulniers Cc: Andrew Morton , Christoph Hellwig , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bdi: fix -Wformat-security Message-ID: <20201023071503.GA30563@lst.de> References: <20201023065754.83084-1-nick.desaulniers@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201023065754.83084-1-nick.desaulniers@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2020 at 11:57:54PM -0700, Nick Desaulniers wrote: > mm/backing-dev.c:810:57: warning: format string is not a string literal > (potentially insecure) [-Wformat-security] > dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name); The callers never pass format strings here. That being said the fix is probably ok anyway, modulo the obvious style issue. > diff --git a/mm/backing-dev.c b/mm/backing-dev.c > index 408d5051d05b..5755578d671d 100644 > --- a/mm/backing-dev.c > +++ b/mm/backing-dev.c > @@ -807,7 +807,7 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt, va_list args) > return 0; > > vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args); > - dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name); > + dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, "%s", bdi->dev_name); Please don't introduce any over 80 char lines.