From patchwork Mon Dec 5 11:32:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 13064413 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CF49C4708C for ; Mon, 5 Dec 2022 11:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbiLELcT (ORCPT ); Mon, 5 Dec 2022 06:32:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbiLELcS (ORCPT ); Mon, 5 Dec 2022 06:32:18 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7148A10569; Mon, 5 Dec 2022 03:32:17 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 4NQhGm1R5fz8R03x; Mon, 5 Dec 2022 19:32:16 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B5BW6mo072861; Mon, 5 Dec 2022 19:32:06 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Mon, 5 Dec 2022 19:32:08 +0800 (CST) Date: Mon, 5 Dec 2022 19:32:08 +0800 (CST) X-Zmail-TransId: 2af9638dd6b8438dfdb8 X-Mailer: Zmail v1.0 Message-ID: <202212051932088061889@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH_security-next=5D_selinux=3A_use_sysfs=5Femit=28?= =?utf-8?q?=29_to_instead_of_scnprintf=28=29?= X-MAIL: mse-fl2.zte.com.cn 2B5BW6mo072861 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 638DD6C0.000 by FangMail milter! X-FangMail-Envelope: 1670239936/4NQhGm1R5fz8R03x/638DD6C0.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638DD6C0.000/4NQhGm1R5fz8R03x Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- 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 9a43af0ebd7d..517fe3454aec 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c @@ -174,7 +174,7 @@ int avc_get_hash_stats(struct selinux_avc *avc, 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(&avc->avc_cache.active_nodes), slots_used, AVC_CACHE_SLOTS, max_chain_len);