From patchwork Thu Oct 17 09:39:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Miguel Almeida X-Patchwork-Id: 13839768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F322D21270 for ; Thu, 17 Oct 2024 09:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ydf94IBLCbwdFZiD8hQTnCOX05UKhFgbH1jfcRWJdnM=; b=vs33mLFPYbFXUCustaEEk+UDl2 iUIhN/SLYZXCVMviKiU27undKBjDM3d0zkpJy9E2L54l4eDXOmO4LOxoZo8sRV03VDtrHaxHyHAzk FTq3H6+RP4k8bGH+nsvcYNiLlEIStNLEyn4S2j0Oh11EgfEypy9pMueQDRtBoxcyijzAYj8GU2X68 L32vNaxnUMp5jbGFHx8gug+qle6zLyc7YOJkXzMM1IJMsWUBuYLuXBv7+5e26sa3fwj1s4lz8/iAV kz+18n8Cc0XQ3uRsGSXvvAh0egH6rbG/MiEvGtavglU+uR/moCKNBNM9k0K0FYvoP5ipcmUkmqM9I IlAMr9ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1NGq-0000000ERkn-46Wd; Thu, 17 Oct 2024 09:58:16 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1Myr-0000000EN3S-3HHT for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 09:39:43 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-71e61b47c6cso575556b3a.2 for ; Thu, 17 Oct 2024 02:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729157980; x=1729762780; darn=lists.infradead.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=ydf94IBLCbwdFZiD8hQTnCOX05UKhFgbH1jfcRWJdnM=; b=UR5Oykt+2+13FyR1RvEnZwzWGZ3D8feHviBpL2dugjykIblhsa1wukx/81baFxVOQH /xRm2dV800wy8tm7DAjRrw7XN35gmNC8QmGMnDYqotciFup2leHX3HcHUBTLPbUXgfTg VcjcgpF73ggPGztpxpAhtxvvMDBxCLJySh3o0fQfXfJlcHyyVZeOW3l4u961PI24KP/K dw08EUPZdpVVu0OLD3hE5qTOywieMRbnmTOPxC9o0Ip2RdOwPNOlbiHYYGp08oELyrkz klzmUW++5ZgTC6TtYIcjtgk5Y3bHL6h7NrAksvc0FR/cDAMsgvr7G+dyJfQem7Hb3EZK isRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729157980; x=1729762780; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ydf94IBLCbwdFZiD8hQTnCOX05UKhFgbH1jfcRWJdnM=; b=cW35Q2FuCNnBiAGuJtndp1VEDKBXVsGPnGrGYuFx6ALHPBK0z5ch2l8Z5rU8DRJk+/ ubPdAZVCbsQD00XAKjdRLWQTXnZy7nXgUXNrBi+t7kytymqzma9/cMnS6TmyifCZOjMJ N9yUGYacjWhIGFN/U0WPlE3rMNYT6IekcmCx54oxsQsAgJ0RdocILDNkJ49wBlddo2Lh O0p1t1s9lFBqYrzhnVJLV6Ct+591lHHUxnVuwkebSXAaPmtEiBDn4OCHOI01ABg3DmHV ogi70reApuLRalKJbLhBrtTOFHPKVFuql8Lxby/bAjzdGDHm6nK2quiGdJ2vIvU4jyEr 6Jug== X-Forwarded-Encrypted: i=1; AJvYcCWI4JaTTtHkrjU8ZEkpo3h5cfm2qROaQv7y17j+Gnxj+3wkR5USBWPK81y+uTbpFZ9JVTMO5vR9Cl84mUII4FhM@lists.infradead.org X-Gm-Message-State: AOJu0YwJyXJsdjiGIeIYeHOsrabmwyOFFnyQenpp+0QL0JBLVCYZocAC H001OQggGR2FtXZPjECStNH7tQpFeGODAAOGRDgEJXBWLVAITJNg4gSU4SRe X-Google-Smtp-Source: AGHT+IEBqVbyOoExw0Cg7ddiHiTaN0dPOHmp4wNIiX3iPqa2LS2/M7QxhxM8sS6KNZx8IP8F0Lj+NA== X-Received: by 2002:a05:6a20:d818:b0:1cf:2a35:6d21 with SMTP id adf61e73a8af0-1d905f69115mr11651591637.45.1729157979950; Thu, 17 Oct 2024 02:39:39 -0700 (PDT) Received: from mail.google.com (125-239-144-11-fibre.sparkbb.co.nz. [125.239.144.11]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea9c6d3eb7sm4027821a12.45.2024.10.17.02.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 02:39:39 -0700 (PDT) Date: Thu, 17 Oct 2024 22:39:34 +1300 From: Paulo Miguel Almeida To: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: paulo.miguel.almeida.rodenas@gmail.com, linux-hardening@vger.kernel.org Subject: [PATCH] ARM: 8611/1: l2x0: replace snprintf with sysfs_emit helper function Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_023941_845833_FE28EDA5 X-CRM114-Status: GOOD ( 11.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org sysfs_emit() helper function should be used when formatting the value to be returned to user space. This patch replaces open-coded snprint with sysfs_emit() helper in sysfs .show() callbacks. Signed-off-by: Paulo Miguel Almeida --- arch/arm/mm/cache-l2x0-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/cache-l2x0-pmu.c b/arch/arm/mm/cache-l2x0-pmu.c index 993fefdc167a..a9bd05b82003 100644 --- a/arch/arm/mm/cache-l2x0-pmu.c +++ b/arch/arm/mm/cache-l2x0-pmu.c @@ -343,7 +343,7 @@ static ssize_t l2x0_pmu_event_show(struct device *dev, struct l2x0_event_attribute *lattr; lattr = container_of(attr, typeof(*lattr), attr); - return snprintf(buf, PAGE_SIZE, "config=0x%x\n", lattr->config); + return sysfs_emit(buf, "config=0x%x\n", lattr->config); } static umode_t l2x0_pmu_event_attr_is_visible(struct kobject *kobj,