Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1772219rwb; Thu, 29 Sep 2022 01:55:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VIp/5KhyPkIkzE3HdAOtj8uVvyWdQPX4rDo8qvuP2iyziiIH52VclmO5V9lLYhBo1LeWh X-Received: by 2002:a17:907:c05:b0:73d:6e0a:8d22 with SMTP id ga5-20020a1709070c0500b0073d6e0a8d22mr1866275ejc.646.1664441753534; Thu, 29 Sep 2022 01:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664441753; cv=none; d=google.com; s=arc-20160816; b=lSZsLaJonHj1jSTZ2k5AoocbaSA6rllb8/mkJChh/Xn/afKmAb8fUFZPjM0Lyds7QU qcaP/j5BZwvyxWBNs7554+faLJfI6ch6cuSraNQfucWnim0qtq+8WmTbgalju5yr63Ay 8/k5Hd7oRmhlwwKuRubDpDM5u2YAp7z1DYq2jP0G+u7pZRAGo0SD6Etc9YW47sGhYXup PehwDngxxZZHaV7EdY8ufMaovWKiHQVA5FwVzOQEoA/uXWACQiD9TPUwhwtdd4XKOoVE +M/DU5K0CJp1YdoyytDi8RtIj8IXYrcvrb8p+Y4GH/qSig8UQtqqB3nU+HTqFm3XXOz7 OZ6w== 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=tKKWFXZii5QgbaLTyEujRe6CHc4wQgmQFi6wf2giT+8=; b=vyUo4Oz/77X1drHTmFduQ919hH7YZpYnJU47c2j4Q+4a/jn9QLPS22l1whBzlX09Rh 86F1lLHzB2UVfKOg9RMvY48TC7RkQ9iEQuJhLwgBx6JbC5WVZiJDvWIyoD8nNWYCta+c y4r/isWtSfbNF3D06NJ7G2823baA9xQnLNSCNwRaanVJh1/zgRAJvInVDdJflC3ycXvk KOfQSzRa0WlkMMQMl8h+C4Ry4u9wg2VkfEpoqDQWRrCcUBhBHnSHKFeDgS74nWa9PW+r vG9k0oXrsE4yloOL2DxWs/pbgLR1NaBGuP4uHKBBneXf0nTdlX85m3t+qfbo778bR4Yf qG2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KnYUG4kP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga30-20020a1709070c1e00b00782a33f2850si7263103ejc.736.2022.09.29.01.55.28; Thu, 29 Sep 2022 01:55:53 -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=@gmail.com header.s=20210112 header.b=KnYUG4kP; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235323AbiI2I2b (ORCPT + 99 others); Thu, 29 Sep 2022 04:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235546AbiI2I2J (ORCPT ); Thu, 29 Sep 2022 04:28:09 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 466461162EC for ; Thu, 29 Sep 2022 01:28:08 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id s14so1013820wro.0 for ; Thu, 29 Sep 2022 01:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=tKKWFXZii5QgbaLTyEujRe6CHc4wQgmQFi6wf2giT+8=; b=KnYUG4kPRTFFu8OzI6Hrw91OKgj5cyB9qkOZakZjah6ri3UWJEBuqAQLjSD9RqcXLW Sf1tkeA6beXxqhpDcY6NC4IhOTfegDjNBgCH3icDbgpezwJnmpY550mTVbDccSsrsVfy Vjd2bYl2ieTHop5yZgl2qAeCdWYeLtv+cS9dzrUVUbq6nIABAXZavG13GdtoealwXpln lTSNvaRLk3HIfWlThKbNfrYjhJLy0hDZL82pLBoTMsBetmC7YZjhESiWxzQw8It3MpNN xoSxL5H7FBIA62CaH/upGlJ3bsHGrF1staTzeDBmh/Y7pj7Ub9quWENwO6iJtK92SKMn bYHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=tKKWFXZii5QgbaLTyEujRe6CHc4wQgmQFi6wf2giT+8=; b=X3CSEOosYDNgfYRsVfmn223clbNp0svCeWu1MKul/YT8iMeDq2yOv1jPOF7Upk28RU Mn+CJCfjLiI9MrhzFSBYhwYgQDrJXCt88hTFZa3e4omqEeFzstmpZNiiIg6V54ronDws jU3QU6n/1PLA7ZH1aBvaVrNQs5XpjSNtM+9PyXEldSfNCjXKVXs8qyCpIpxeMvNzDlPQ c762lOtD8ZQHjpZUtAzMrNBvm8Fy7Df/PK3MmCx50TTwD56csNvoo/2WK7iebXrQd52d y4WOhYYhfKKFmrzxiOntOrTYzK51RCksNl9X4xfumJKAEv9Pv/XKov7e5ehaAbbYF4xh EedA== X-Gm-Message-State: ACrzQf0FHYSXIebLZvHdu51B/p+6gvVeClNmFd5vsI0xIesPkzq33pRu /wMe1cdroRm5ZxghXJ5OGioVbunIHw== X-Received: by 2002:adf:cd86:0:b0:22c:c7ce:1e5e with SMTP id q6-20020adfcd86000000b0022cc7ce1e5emr1248352wrj.462.1664440086632; Thu, 29 Sep 2022 01:28:06 -0700 (PDT) Received: from octinomon ([2a00:23c8:2f02:3b01:3ea1:40:8650:189]) by smtp.gmail.com with ESMTPSA id fc10-20020a05600c524a00b003b435c41103sm5544486wmb.0.2022.09.29.01.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 01:28:06 -0700 (PDT) Date: Thu, 29 Sep 2022 09:28:04 +0100 From: Jules Irenge To: David Sterba Cc: peterz@infradead.org, Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [tip: perf/core] perf/core: Convert snprintf() to scnprintf() Message-ID: References: <166374773592.401.16831946846027095231.tip-bot2@tip-bot2> <20220921125535.GF32411@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220921125535.GF32411@twin.jikos.cz> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Wed, Sep 21, 2022 at 02:55:35PM +0200, David Sterba wrote: > On Wed, Sep 21, 2022 at 12:44:35PM +0200, Ingo Molnar wrote: > > > > * Peter Zijlstra wrote: > > > > > On Wed, Sep 21, 2022 at 08:08:55AM -0000, tip-bot2 for Jules Irenge wrote: > > > > The following commit has been merged into the perf/core branch of tip: > > > > > > > > Commit-ID: 678739d622ae7b75b62d550858b6bf104c43e2df > > > > Gitweb: https://git.kernel.org/tip/678739d622ae7b75b62d550858b6bf104c43e2df > > > > Author: Jules Irenge > > > > AuthorDate: Sun, 18 Sep 2022 00:41:08 +01:00 > > > > Committer: Ingo Molnar > > > > CommitterDate: Wed, 21 Sep 2022 10:01:20 +02:00 > > > > > > > > perf/core: Convert snprintf() to scnprintf() > > > > > > > > Coccinelle reports a warning: > > > > > > > > WARNING: use scnprintf or sprintf > > > > > > > > Adding to that, there has also been some slow migration from snprintf to scnprintf. > > > > > > > > This LWN article explains the rationale for this change: > > > > > > > > https: //lwn.net/Articles/69419/ > > > > > > > > No change in behavior. > > > > > > > > [ mingo: Improved the changelog. ] > > > > > > And yet, at this point I still have no clue what's wrong with > > > snprintf(). So not much improvement :/ > > > > I've added this to the changelog: > > > > perf/core: Convert snprintf() to scnprintf() > > I'm not sure if it would apply in this case as it's for a device > attribute, but there's another helper sysfs_emit that does the safe > print to string and one does not have to care which flavor of s*printf > it is. We had patches in btrfs converting from snprintf to scnprintf and > the latest one is sysfs_emit which is convenient to use but assumes the > PAGE_SIZE of the buffer. Yes, you are right. I can resend the patch with sysfs_emit() if possible as the latest documentation on sysfs states that show() device function should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. * https://www.kernel.org/doc/html/latest/filesystems/sysfs.html I don't know whether it may apply to this subsystem. I have to read more about it and test thanks jules