Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1246124iol; Sun, 12 Jun 2022 10:06:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMszArzAy8vSVoT4O2xnMG7FlgJJovi5oZc5vKlstfnBYKB1FY3pIF48R2EXV+gy56mFlV X-Received: by 2002:a17:902:ebd1:b0:162:224f:abbb with SMTP id p17-20020a170902ebd100b00162224fabbbmr54193918plg.160.1655053595908; Sun, 12 Jun 2022 10:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655053595; cv=none; d=google.com; s=arc-20160816; b=vDFlV5cGR29s77/6NNcuWx8FekDPbh95q7ZlaRhzQWrTzPLfQkw+xl6U/i/4wIlldf uqADeyW/BgR97dkwSSMTNtiW6q3MsKCE5npXa7puUiD9f5GftUK3WRZv4cmp2KDQPpWB U3Pv4xnSB5/ASOfFQhvDe7mklu1ms+v3fVv9gW04oMdmqCxLp/5qg20SUeQcVwtlbQe/ InN/YYxHXr5LhJvYnkm4i3joocPjXW4mvTwJzyLWGgXjxps0p5juMbHfzd4P6zlcR3Iy rPur3/nbMtIVzLhuDNZIkxNIck5QPTgirANKOXLc+7FHNvE1WiTB8Zpgn8UqSHGccQel CHtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Bp1t0MAX0vF2MFrixDjLhlmP3KLo6hgWxyC3M+usaE8=; b=qNbkCQBtqprWpSu3U91l60hrFpSCs1UTpIDrg5IRO/4cwagM2tDbd4wIv5JyexJkYl FO+aLeJzgrssiqEtrFsUdWS2jHKmZDl3FOU89rfWf6ktinRuPqkLVYSZLfMwf8wDhjrF 3LDsJNCIDiGA9WgtxHgWvpGXsrnQ13qsDtnJbb5boZYjvGivJtsHLHUc6VQ1FkmuY39C 0n6OsZG5j2+rzJcbeHvif69Gh5jLsBkecoF0b5rvokoda5KUkFadC85V996Ft0qSMSiO PKba8sc90NWldvzPxq4Vrjc6B6I0XsvzFiABzJeUzQi0VxD+6+l6cSlsh6el+uwgqchj Lp5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@philpotter-co-uk.20210112.gappssmtp.com header.s=20210112 header.b="R/sEjCaZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a170902ce8300b00163f8c2deabsi8481177plg.257.2022.06.12.10.06.24; Sun, 12 Jun 2022 10:06:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@philpotter-co-uk.20210112.gappssmtp.com header.s=20210112 header.b="R/sEjCaZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbiFLQX5 (ORCPT + 99 others); Sun, 12 Jun 2022 12:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbiFLQXz (ORCPT ); Sun, 12 Jun 2022 12:23:55 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586885E15D for ; Sun, 12 Jun 2022 09:23:54 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id m16-20020a7bca50000000b0039c8a224c95so1003286wml.2 for ; Sun, 12 Jun 2022 09:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philpotter-co-uk.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Bp1t0MAX0vF2MFrixDjLhlmP3KLo6hgWxyC3M+usaE8=; b=R/sEjCaZtQEnfPFaK+UnnTh0wg4bRV6svzZB+oS2hfNNJzpfcRRfcZmCJOP8EySmQd g+xcBgfqADhJshLEY78CKFvKjnbnDQTiZlNPaYQ4krJN4DIZr0DcF9zio2w2kHV8Sq+E bLM/i/SzIos3D8gnl2FjBUdtUwk4BOXJ/p4Gz7UFvasXpv6HXMR+5PupsiPSPR0TnZya F4NsEqC4DRhyBo+zGRqyKs6C3D88H2ZM6iKWsmgHMRXInXx2VY+xkqjwHyZXLhqJ9DIi GLX8O48hgFb+6agiYOXIOISy12Ll9TGb3KH9UckWOW5W3iIlklqwzjxaxwQD5RPR2Sdf 1JcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Bp1t0MAX0vF2MFrixDjLhlmP3KLo6hgWxyC3M+usaE8=; b=lJMd1atp7SbOxbnRgS1/6re/E5PNM/FyRyvW/gaHGWp3aZTCt92lDCJRSw67pi88/b UfLxNpfckiCy2UpcBwaU/UqNg2+7Ah8BSaD1lBMH2RhV9U52naMib3eAK2IC3luzi5hR qIkSol1QqRv1eMHWIg8l3t+79qQ7rDH5lWt5gW3u2tzKc7Uc0vLEq5wbYmmtb8q0lNFN NERmrudwckN8OxKnefXaZ3BU6Vnu4lMy47uojGnO5WIZQz21fUfiTt2eje1z2voBdXJo oJqrtSWdpjIufijfNYQvRxsc49pDM2xw67CI2kp2/mDe+vs92z/1KJXK1yINrcCb3kBk Avkg== X-Gm-Message-State: AOAM530CiBaTaK13mLk7sSXIP8H9unRA7ziTzR15sQeigABUIJNps+Nu YR1sKv5cn03xz4x3IPMb7xhr0A== X-Received: by 2002:a05:600c:2682:b0:39c:8ec6:57d9 with SMTP id 2-20020a05600c268200b0039c8ec657d9mr3559545wmt.99.1655051032703; Sun, 12 Jun 2022 09:23:52 -0700 (PDT) Received: from equinox (2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.a.1.e.e.d.f.d.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:dfde:e1a0::2]) by smtp.gmail.com with ESMTPSA id bh8-20020a05600c3d0800b003942a244ee6sm6005715wmb.43.2022.06.12.09.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 09:23:51 -0700 (PDT) Date: Sun, 12 Jun 2022 17:23:47 +0100 From: Phillip Potter To: Bill Wendling Cc: isanbard@gmail.com, Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Phillip Potter , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jan Kara , Andrew Morton , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jaroslav Kysela , Takashi Iwai , Nathan Chancellor , Nick Desaulniers , Tom Rix , Ross Philipson , Daniel Kiper , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, alsa-devel@alsa-project.org, llvm@lists.linux.dev Subject: Re: [PATCH 08/12] cdrom: use correct format characters Message-ID: References: <20220609221702.347522-1-morbo@google.com> <20220609221702.347522-9-morbo@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609221702.347522-9-morbo@google.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 10:16:27PM +0000, Bill Wendling wrote: > From: Bill Wendling > > When compiling with -Wformat, clang emits the following warnings: > > drivers/cdrom/cdrom.c:3454:48: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] > ret = scnprintf(info + *pos, max_size - *pos, header); > ^~~~~~ > > Use a string literal for the format string. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Bill Wendling > --- > drivers/cdrom/cdrom.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c > index 416f723a2dbb..52b40120c76e 100644 > --- a/drivers/cdrom/cdrom.c > +++ b/drivers/cdrom/cdrom.c > @@ -3451,7 +3451,7 @@ static int cdrom_print_info(const char *header, int val, char *info, > struct cdrom_device_info *cdi; > int ret; > > - ret = scnprintf(info + *pos, max_size - *pos, header); > + ret = scnprintf(info + *pos, max_size - *pos, "%s", header); > if (!ret) > return 1; > > -- > 2.36.1.255.ge46751e96f-goog > Hi Bill, Thank you for the patch, much appreciated. Looking at this though, all callers of cdrom_print_info() provide 'header' as a string literal defined within the driver, when making the call. Therefore, I'm not convinced this change is necessary for cdrom.c - that said, in this particular use case I don't think it would hurt either. I've followed the other responses on parts of this series, so I understand that a different solution is potentially in the works. Thought I'd respond anyway though out of courtesy. All the best, Phil (Uniform CDROM Maintainer)