From patchwork Sat Mar 15 06:12:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xie.ludan@zte.com.cn X-Patchwork-Id: 14017728 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) (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 7880F10F9; Sat, 15 Mar 2025 06:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.216.63.40 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742019142; cv=none; b=HZmk4rQIHFkVYCGsgasKxCQnoA2zVhn3wQ31dCl8euaievOZCeMOS+b6JqP23e9lvOlK48GUmXG2YFC9NpoCebPINyTkY0t6M7+EOcdtXbB+LevjV9ryZnKW27yO+XU9DtXX+5BqKrsLw8iQB5OUEKED/1Gma6VpAKdErqPwMHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742019142; c=relaxed/simple; bh=685XdThuWSpH7Qcd4HYHNcBPYlZrmCB0071uw//M3O4=; h=Date:Message-ID:Mime-Version:From:To:Cc:Subject:Content-Type; b=NhpUue2kWa/4PKWT+xX/cRaegBNHEQo8TxKRI1KJr6+IPIPS6NSba64ywZotiMPG2Ztb6MgIdUVj92Wla7LSTMCmPO7XaTuIL7a5l9vHquzVEdwyUyzYocovpVeXq3zPCoOGhNIUE77ey7uCXVVIdnifypYxKqcYoVjwF74nw+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=63.216.63.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4ZF9qv5s4hz8R03d; Sat, 15 Mar 2025 14:12:11 +0800 (CST) Received: from xaxapp04.zte.com.cn ([10.99.98.157]) by mse-fl1.zte.com.cn with SMTP id 52F6C7vd009399; Sat, 15 Mar 2025 14:12:07 +0800 (+08) (envelope-from xie.ludan@zte.com.cn) Received: from mapi (xaxapp04[null]) by mapi (Zmail) with MAPI id mid32; Sat, 15 Mar 2025 14:12:09 +0800 (CST) Date: Sat, 15 Mar 2025 14:12:09 +0800 (CST) X-Zmail-TransId: 2afb67d51a3913e-5bf3e X-Mailer: Zmail v1.0 Message-ID: <20250315141209936kL2XHnj3IaE2dYcjQZlnV@zte.com.cn> Precedence: bulk X-Mailing-List: selinux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH_linux-next=5D_selinux=3A__avc=3A_use_sysfs=5Femi?= =?utf-8?q?t=28=29_instead_of_scnprintf=28=29?= X-MAIL: mse-fl1.zte.com.cn 52F6C7vd009399 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 67D51A3B.000/4ZF9qv5s4hz8R03d From: XieLudan Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: XieLudan --- security/selinux/avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 4b4837a20225..007bd94975c0 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -164,7 +164,7 @@ int avc_get_hash_stats(char *page) rcu_read_unlock(); - return scnprintf(page, PAGE_SIZE, "entries: %d\nbuckets used: %d/%d\n" + return sysfs_emit(page, "entries: %d\nbuckets used: %d/%d\n" "longest chain: %d\n", atomic_read(&selinux_avc.avc_cache.active_nodes), slots_used, AVC_CACHE_SLOTS, max_chain_len);