From patchwork Mon Aug 14 16:33:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13353070 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83792C001DB for ; Mon, 14 Aug 2023 16:27:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25F8B6B0075; Mon, 14 Aug 2023 12:27:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 210036B0078; Mon, 14 Aug 2023 12:27:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D7B46B007B; Mon, 14 Aug 2023 12:27:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F38BC6B0075 for ; Mon, 14 Aug 2023 12:27:03 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 60F08140BA0 for ; Mon, 14 Aug 2023 16:27:03 +0000 (UTC) X-FDA: 81123239526.08.AA54507 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by imf04.hostedemail.com (Postfix) with ESMTP id 2BA5A4000E for ; Mon, 14 Aug 2023 16:27:00 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="gzvX/q6a"; spf=none (imf04.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.100) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692030421; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aoQdUnUxWu79/wu/ynaQz9sqIF+EP8+qxQ7gq7KmF9k=; b=6GtCklcUDJjsmfmOIM9Kk0KjM7SZXDBpuli4WRhgUHmcUM33lgFPNpbbbffbZmDonHohtn oy0Ri0lIJqT4vuqXZSvN+RmN6fgBFtIi1oPkm023MPOFaDNYDzkNeQ1/gfbjmqTS6CPitw wBDkDE0MQCljh+fPT24UDFupoJ1AvsU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692030421; a=rsa-sha256; cv=none; b=c8bMErpDhyABr1M057R82iskqIcjabohezX0sh+HjiKU7GYrTHjgvQ/xIfqbxagexzU43h S40AhvaOLk/FJUfXvWIdnoexbQi0zKcZwfP78OWA8TPzqN8HeDVf5kGnZhlZI1dGUXO2z9 g5UHFSX8sZqv0y/25tVCt5r2B+53lZA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="gzvX/q6a"; spf=none (imf04.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.100) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692030421; x=1723566421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LZQOx7C238eM5ntkHv1oYly7+slLbIPiN9FmjDzt/5w=; b=gzvX/q6alaS/YkdpOQEkOn+XhMhiyNdLUq/SXf2Pr3SDhP7EndgV3Gcq eGzw3Y8hw3/b0GkLs4DEz0ri/Nb2Rx/ExHKUby7L2A8cwBxrkELFf/n9o 3g/G2i79E1BqlcRuRRg38eMx897QThi6ci5QBD6AqhgvLmIGinavQlb+t pf350EsCHVaJdtxFaoKvSPFUiVzonNfPgqLhUE3uhxQq5CfYjh72b97yA YLBHRFIz0QwiM4KE5UcFXXBxPjmiyfPNlyDtvi2qOjtFMrigfz8SegZiy MB6srWJ8cww1CD/U92Mp+aYDPl8d5yd1vGzuMUv7ZLZJyJ0lQ65W63FTP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="438415051" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="438415051" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 09:26:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="736565824" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="736565824" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 14 Aug 2023 09:26:19 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 62A54370; Mon, 14 Aug 2023 19:33:48 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Petr Mladek , Marco Elver , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Alexander Potapenko , Dmitry Vyukov , Andrew Morton Subject: [PATCH v3 1/2] lib/vsprintf: Split out sprintf() and friends Date: Mon, 14 Aug 2023 19:33:43 +0300 Message-Id: <20230814163344.17429-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230814163344.17429-1-andriy.shevchenko@linux.intel.com> References: <20230814163344.17429-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2BA5A4000E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: waoxxkpsg4wtt4o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hRC5omYKJRza/BlvlGZVRy63IRXNwkbvux+fsLHZiCOia00ai4ob+0/ja5VLVUBX1pGi30WwLqtuSEiA3OMiiARVpViCQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: kernel.h is being used as a dump for all kinds of stuff for a long time. sprintf() and friends are used in many drivers without need of the full kernel.h dependency train with it. Here is the attempt on cleaning it up by splitting out sprintf() and friends. Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek --- include/linux/kernel.h | 30 +----------------------------- include/linux/sprintf.h | 25 +++++++++++++++++++++++++ lib/test_printf.c | 1 + lib/vsprintf.c | 1 + 4 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 include/linux/sprintf.h diff --git a/include/linux/kernel.h b/include/linux/kernel.h index b9e76f717a7e..cee8fe87e9f4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -203,35 +204,6 @@ static inline void might_fault(void) { } void do_exit(long error_code) __noreturn; -extern int num_to_str(char *buf, int size, - unsigned long long num, unsigned int width); - -/* lib/printf utilities */ - -extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); -extern __printf(2, 0) int vsprintf(char *buf, const char *, va_list); -extern __printf(3, 4) -int snprintf(char *buf, size_t size, const char *fmt, ...); -extern __printf(3, 0) -int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); -extern __printf(3, 4) -int scnprintf(char *buf, size_t size, const char *fmt, ...); -extern __printf(3, 0) -int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); -extern __printf(2, 3) __malloc -char *kasprintf(gfp_t gfp, const char *fmt, ...); -extern __printf(2, 0) __malloc -char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); -extern __printf(2, 0) -const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args); - -extern __scanf(2, 3) -int sscanf(const char *, const char *, ...); -extern __scanf(2, 0) -int vsscanf(const char *, const char *, va_list); - -extern int no_hash_pointers_enable(char *str); - extern int get_option(char **str, int *pint); extern char *get_options(const char *str, int nints, int *ints); extern unsigned long long memparse(const char *ptr, char **retptr); diff --git a/include/linux/sprintf.h b/include/linux/sprintf.h new file mode 100644 index 000000000000..9ca23bcf9f42 --- /dev/null +++ b/include/linux/sprintf.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_KERNEL_SPRINTF_H_ +#define _LINUX_KERNEL_SPRINTF_H_ + +#include +#include + +int num_to_str(char *buf, int size, unsigned long long num, unsigned int width); + +__printf(2, 3) int sprintf(char *buf, const char * fmt, ...); +__printf(2, 0) int vsprintf(char *buf, const char *, va_list); +__printf(3, 4) int snprintf(char *buf, size_t size, const char *fmt, ...); +__printf(3, 0) int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); +__printf(3, 4) int scnprintf(char *buf, size_t size, const char *fmt, ...); +__printf(3, 0) int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); +__printf(2, 3) __malloc char *kasprintf(gfp_t gfp, const char *fmt, ...); +__printf(2, 0) __malloc char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); +__printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args); + +__scanf(2, 3) int sscanf(const char *, const char *, ...); +__scanf(2, 0) int vsscanf(const char *, const char *, va_list); + +int no_hash_pointers_enable(char *str); + +#endif /* _LINUX_KERNEL_SPRINTF_H */ diff --git a/lib/test_printf.c b/lib/test_printf.c index 7677ebccf3c3..ce749cfac033 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 40f560959b16..afb88b24fa74 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include From patchwork Mon Aug 14 16:33:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13353069 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B0AC001DB for ; Mon, 14 Aug 2023 16:26:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DD846B0075; Mon, 14 Aug 2023 12:26:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78D476B0078; Mon, 14 Aug 2023 12:26:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 607808E0001; Mon, 14 Aug 2023 12:26:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 48CEE6B0075 for ; Mon, 14 Aug 2023 12:26:27 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1B4DAA0B21 for ; Mon, 14 Aug 2023 16:26:27 +0000 (UTC) X-FDA: 81123238014.19.6116A72 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by imf24.hostedemail.com (Postfix) with ESMTP id C4C3E18001A for ; Mon, 14 Aug 2023 16:26:24 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=QhFAmBw8; spf=none (imf24.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692030385; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V3WuGizvUxC5vuhzZZFDGOR3mhwu63Zix/qU35Czt8E=; b=rD9vNFfP9ICQgGa43x45YxPQvmQYAb3T7MkSIDS0E9UYkMqA/O2MwDIcQdDzwRfI5fhw1+ afVo/8R6UDcIH5t0G3i0BrQnbO1qT+kJK0I6MDuQsRhqiDV7oe5tyZ0a6GQ/ohPufvXWz0 Jw85gyHeiFqP87T1sFa1ptnepjBbrNk= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=QhFAmBw8; spf=none (imf24.hostedemail.com: domain of andriy.shevchenko@linux.intel.com has no SPF policy when checking 134.134.136.24) smtp.mailfrom=andriy.shevchenko@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692030385; a=rsa-sha256; cv=none; b=Q9Sftwi6hlXFFd5gqMX1YOqugT1GjC+lI3HPR53XKdpMSzeBq/M0YC8CAY78WWNgukMKvz 5YNTW1Otwr2ycr5OM9T79qsImqMKm+O0oREs817d3XTL4GTy+napTG9UtgmtcT774z93lx TN+zcEBw4yIQYpefXDC+l7SCvOAHaOI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692030384; x=1723566384; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8kHf+dvmKQBM1iVcpQWZ+d+J4wh5hZpOnrYE1R/YRJ0=; b=QhFAmBw8AGBBWwYbMnl583c7iQhhv/SI12YvcRcwTe2VuwSZFxqU2iFW ggUAWc9NDSe9P3v0kQSsQsDmShNT36fJejPcBTRMuAxpU6g4wp6b3BVZX SrCJevIUqc+hcZzuogu9BqEQo+8nxaXK6AOxGHxncqeqsGrkC2Br5l3bs 6npqw0cvFcdhv7WHJCPu0T9UdHsWTlluOgJFdt/gDQb0UaeZ92MDkYQlI 3PrEP8fbShsqHvVU1k4YsXnrFJ3ffU+07E3b4bJXumgrZPfkRevqaryPz gjmAi4QtuU2pTQDGiSJLk9b36l9klLYq11i03LRXZMjz0cMSyF9m9zXM8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="374852974" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="374852974" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 09:26:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="762991308" X-IronPort-AV: E=Sophos;i="6.01,173,1684825200"; d="scan'208";a="762991308" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 14 Aug 2023 09:26:19 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D6FF8374; Mon, 14 Aug 2023 19:33:48 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Petr Mladek , Marco Elver , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Alexander Potapenko , Dmitry Vyukov , Andrew Morton Subject: [PATCH v3 2/2] lib/vsprintf: Declare no_hash_pointers in sprintf.h Date: Mon, 14 Aug 2023 19:33:44 +0300 Message-Id: <20230814163344.17429-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230814163344.17429-1-andriy.shevchenko@linux.intel.com> References: <20230814163344.17429-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C4C3E18001A X-Rspam-User: X-Stat-Signature: mh3umdembfd1fybgscnm6f5hbyxbkpzb X-Rspamd-Server: rspam01 X-HE-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IvPdJFdNsXu1pp06wlj+BgngwyELiBAyTLaBen6t4DQ7vppJVAHZdQ00Nm5+wrd25bETBETK7yY9WPBikJqiKpjIml6eXSTv/RhNOidrCyAXtVsY+T86Adzr8BRVIWQW7Msy5WZBuqH8G9hg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Sparse is not happy to see non-static variable without declaration: lib/vsprintf.c:61:6: warning: symbol 'no_hash_pointers' was not declared. Should it be static? Declare respective variable in the sprintf.h. With this, add a comment to discourage its use if no real need. Signed-off-by: Andy Shevchenko Acked-by: Marco Elver Reviewed-by: Petr Mladek --- include/linux/sprintf.h | 2 ++ lib/test_printf.c | 2 -- mm/kfence/report.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/sprintf.h b/include/linux/sprintf.h index 9ca23bcf9f42..33dcbec71925 100644 --- a/include/linux/sprintf.h +++ b/include/linux/sprintf.h @@ -20,6 +20,8 @@ __printf(2, 0) const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list __scanf(2, 3) int sscanf(const char *, const char *, ...); __scanf(2, 0) int vsscanf(const char *, const char *, va_list); +/* These are for specific cases, do not use without real need */ +extern bool no_hash_pointers; int no_hash_pointers_enable(char *str); #endif /* _LINUX_KERNEL_SPRINTF_H */ diff --git a/lib/test_printf.c b/lib/test_printf.c index ce749cfac033..69b6a5e177f2 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -42,8 +42,6 @@ KSTM_MODULE_GLOBALS(); static char *test_buffer __initdata; static char *alloced_buffer __initdata; -extern bool no_hash_pointers; - static int __printf(4, 0) __init do_test(int bufsize, const char *expect, int elen, const char *fmt, va_list ap) diff --git a/mm/kfence/report.c b/mm/kfence/report.c index 197430a5be4a..c509aed326ce 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -26,8 +27,6 @@ #define ARCH_FUNC_PREFIX "" #endif -extern bool no_hash_pointers; - /* Helper function to either print to a seq_file or to console. */ __printf(2, 3) static void seq_con_printf(struct seq_file *seq, const char *fmt, ...)