From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A39823783D8 for ; Mon, 23 Feb 2026 21:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771880734; cv=none; b=YCEX+bpyrXycITtzjkCN3sxsxg9K2qFIg5QJS7xnwGVSf7esBlbhsvtFgjDe2/AmpXgrSA2LEMn2rBf74U7SxUYnvzUGmsQGFxTbYk9+RdIJckqJDrWoHltwSorsZJMXKts7E/7+SATp99kTLl0GBa3dLads+v/eL7krYaYn5N8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771880734; c=relaxed/simple; bh=W0HLqr4M+aT9zcs+iBjjowOW9dEMVPG5rR6ftCMpuds=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iAmEeDwN74G2PwoA81TNRHqdIs0e3IpAHoP7Lz1r7RKFfRxKpmyhJ5l86XQPNabxj6DlgSdYREsSmWSAEJqD4AyBwPurhlkknWFb4nKPd2eHneBO6rRI8GbvGrrEKUxLTgyUy6HjyC1L4dQhMVmXMCGd5lHm6Se6n2GLbJxDeYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Gcpvbegx; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Gcpvbegx" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1771880728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jre9+4UjOPVBJ/a4+bDyRbBtwEbG+MxVnSpNOnp6Bwc=; b=GcpvbegxpJ86YYXGF2JPYOMkYvx6Xtcwi4as+ok16aoboW2xvOgMHyHtSmFFc6Qn0PnwDH ylIrDUOS8/d+bb0OapryM8w78ue3iiGhKcTcJgWRE8BOwQt1K3jDW/EaqJwfqtmWtVn51t qyUUfAWIsK0/G1/S92fkqSzDtMeaogg= From: Thorsten Blum To: "Rafael J. Wysocki" , Viresh Kumar Cc: Thorsten Blum , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: governor: Use sysfs_emit in sysfs show functions Date: Mon, 23 Feb 2026 22:03:51 +0100 Message-ID: <20260223210351.344388-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Replace sprintf() with sysfs_emit() in sysfs show functions. sysfs_emit() is preferred for formatting sysfs output because it provides safer bounds checking. No functional changes. Signed-off-by: Thorsten Blum --- drivers/cpufreq/cpufreq_governor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 168c23fd7fca..732fd4d1a803 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -21,6 +21,7 @@ #include #include #include +#include /* Ondemand Sampling types */ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; @@ -57,7 +58,7 @@ static ssize_t file_name##_show \ { \ struct dbs_data *dbs_data = to_dbs_data(attr_set); \ struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \ - return sprintf(buf, "%u\n", tuners->file_name); \ + return sysfs_emit(buf, "%u\n", tuners->file_name); \ } #define gov_show_one_common(file_name) \ @@ -65,7 +66,7 @@ static ssize_t file_name##_show \ (struct gov_attr_set *attr_set, char *buf) \ { \ struct dbs_data *dbs_data = to_dbs_data(attr_set); \ - return sprintf(buf, "%u\n", dbs_data->file_name); \ + return sysfs_emit(buf, "%u\n", dbs_data->file_name); \ } #define gov_attr_ro(_name) \ -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4