From patchwork Sun Feb 25 04:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1424825dyb; Sat, 24 Feb 2024 20:06:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYT7U1CjCfUgJAMENAQxvC2EavquBDmB4fLqX9Kbq8XIHvLiPBSjciAyZLW5DAb3sFZ3ILVoBjb1UL4AJQOVw3VW8peg== X-Google-Smtp-Source: AGHT+IH+nAIo0L2UUjU6RO97kan55lp/NIplaZn6ljmIuydlnYkw+PcaQlsFoFQyU8ZboEof10gl X-Received: by 2002:a05:6808:3094:b0:3c1:66f9:f991 with SMTP id bl20-20020a056808309400b003c166f9f991mr4936836oib.10.1708834005260; Sat, 24 Feb 2024 20:06:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834005; cv=pass; d=google.com; s=arc-20160816; b=dxqqNbnaZEBgejIdZLmsi9X80e6ikEoS1T0zeo+hToqKOYVriMMbu9g5FMSlPKjtkf zk9HWi6aEWRf+zS5lUgtpacaF5u5XSn0hfFSgFYdeYKRHCUhaT9Vyk0sL9c54qZGxEsa dj29Yffh6kALLDDF6KfmflRoM9hmZ//y03GxBwY3cZEOl7p4wsM46Vnsd5SnpAALJQtV UvaiXIdZs0w6bDSpojedz0dim2txMgpYrRoup4Z98eIjau+f9UNKMz9xwtLe7k7XDtmY +zl3rVozhiDNkVZXydwFjEMbbne/7/93M9kSuJBf0E/eZ5GAbt9x2job+MCxn8eZtxuB v8mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=eeuZJq6Fxo2cYyc6x11JY0tSqm747i90EQ3x4JLdDpA=; fh=gRLC4gLca4bkLA88sgL24ADNdiHmN1pE9ZWkE4mfeIg=; b=THS8VOkBaNzKvQqNGCDdc9NMaUPYW0OqI5Mz8Y9SoPZQcDAKKwdKGtN9sWPDtQh5oa 0YAhwuLHiNDEHmaPWAeAZNX2zyr1n/BPuh2JloAuz6LNXT0TiNmwkNu2dC542XEbj9wi wXDSYVts7c03watZhGlxHL4awr8qAe8GHzviHQzpSNZTY4Xvd3xJW3bxKeyHda0rH0CV KTg8ZbXBHBFmJCc8b1srpgXV0S2b1rnbogsHAtqn8rygOjzjw31lMzI33Z5nOcOhT8Z4 XgqNoXseC+Pl5NZFrJzSTWrVKNggljJ2bU4pG2lzOoDdOaB2d9wIuuJNs73F176HSou0 msOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=MWg1CTzB; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79967-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79967-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o17-20020ac85551000000b0042e66404858si2278653qtr.667.2024.02.24.20.06.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:06:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79967-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=MWg1CTzB; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79967-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79967-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0FE941C20E3D for ; Sun, 25 Feb 2024 04:06:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE1328C10; Sun, 25 Feb 2024 04:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="MWg1CTzB" Received: from out203-205-221-233.mail.qq.com (out203-205-221-233.mail.qq.com [203.205.221.233]) (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 6835233E1 for ; Sun, 25 Feb 2024 04:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708833992; cv=none; b=R/amVBWB5z0xudoyUSD7/Q/tUAd25BSYfAwRQcSYulbFFGwB+KjqaIgZwlAMPHPPo3WxR0xDU6T0judC/XZE0dGX2EVNZbjqas7kDJbBmUBFQ0jgY0Sgm8d5Ld799TUt6p5ewTPFvrgB2Ne6S7Luj5QM/0neqGYxs0NoZaWaQxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708833992; c=relaxed/simple; bh=v0u0UY6IZLeK7m5DJpMpA2gcsbr5QD2SeoS8vKGYb4s=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=j7mLz8t595u7dPQ3Olj5yqwYIRlyW7L1rxa0U+PB+vnSCYj1QQNW5B8TgF/I30c0S3LoLPSKm0aefA7EXeHOfCxEDyiEJ856REXSE7C5JVJvBDLNN+6iSgh9YjyifQGpctbbwdnRdx/gwRYZ1kpSPT9pBdXnXkOXGkAVKOqtmmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=MWg1CTzB; arc=none smtp.client-ip=203.205.221.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708833981; bh=eeuZJq6Fxo2cYyc6x11JY0tSqm747i90EQ3x4JLdDpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MWg1CTzBCcYkNXIeWTckng8BjAbOVlYgk158ElE+Vt8ArDpGlcViwMkRMQpqthccZ W/nncZjO8yhbo3iNSutc8OuH6kXRRJUyYaH5MHSLMOK577r/6+f/e5Pe3YfJg0ZF6h 3POEwVzul5tPfpwvaH7ZpO6zkLH0CE8AOwfejP00= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708833973tqo6zfhr6 Message-ID: X-QQ-XMAILINFO: OQ59tfF64tJLisGDfjHLssboL2wrAS+OJRngdWOM2ugGCBYT8TEY4f7nQdWleK PZVJRFePG7rTc/H+tpBH+NvaJHtnD83UM6gNBWzQM990fbc40e+g4u3PweR79sjfEm6iCPdrF2si mQtoR7zWd4JJQtkYm6YzFCyU+6JHD9hi/6A1S+Er1yDoeg57zcHZUNNEhF2JHmhjb3bKP/FIzE4/ AULq5O9opHJxz0dp+qwsX08fJHP5FgOToRSBE1F/VFqh2Wl8FnA8ENIErQvKdfG6wRn0jxuCUCwt aEaxjWRpKGGczA2grKZ0ynSRZrQf+8PRJBjRDdyOLGXqsH69itJeDIYf71HMse992xWfC4giiyAX TDX+qkmNG7YY3jrfcg5/wvXfv+pnOZU3qIdiDAylAgPS5zBWMBJzHFH/BAyIdb51vkusD2Ww/7sp q1MY7uPGasrnH2Z0/NbUBj7g7BV1fDL/ghsuBOZVKaP5RFfUzjKaNrt2LcrMHVh+blNgW8N9SXhF OYziCHd7hKAq8t+it2WdV6Vi/Qiv1MVltuY6Fat14O811aUOb7rQK+ovLCpoHVyHH71f4E8rJ9h+ ONVj7VwwAZyqcKkHrHWeVs7lol0BObISUSCfY2B2MVi/y2X2gVmWScumxI4+Pg5XXU4XfQypyNS8 TjlRCks2BCiY+1xGFVr/E4aLwopXT5Hx7vy94CAGtIuH446umSkDsW9H9trWt5wAbCqlj9uhXG4D uYaeG/pNU23GE4AEY5WLueV4tyt7pdkIEIA6MyWZcIOHUZJcteqzAvMmfciM95smvStIx7OLcWpc eNk8KnNpmPHRo6c2CEtmSiRMgBLZtazBB2hjogd3PWRAzhBrJdEzLOVvJaY0AuciMRkxc5Q6hCh+ 4SChtu1tXpw5VXGqKxBqCUxWxJv55w1qJFuTrsqasjWtFhW7Yeo7HGnzyt2JirbVk1v76FPVUV9m /lNPJ0+PJlZJqpuu8Qvd77dFceAqi0Pu0We1raKJAOL2E8cFaRwFarZbT/OZTnF+nKlTmLvIs+yW XojuIqRzpZK1wegq8+qa0jwh3Y/PHGj0lcx/jwC0xiL1XUeqJN X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] sysctl: introduce sysctl SYSCTL_U8_MAX and SYSCTL_LONG_S32_MAX Date: Sun, 25 Feb 2024 12:05:31 +0800 X-OQ-MSGID: <20240225040538.845899-2-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842326055602622 X-GMAIL-MSGID: 1791842326055602622 From: Wen Yang The boundary check of multiple modules uses these static variables (such as two_five_five, n_65535, ue_int_max, etc), and they are also not changed. Therefore, add them to the shared sysctl_vals and sysctl_long_vals to avoid duplication. Also rearranged sysctl_vals and sysctl_long_vals in numerical order. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: "David S. Miller" Cc: David Ahern Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/linux/sysctl.h | 15 +++++++++------ kernel/sysctl.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ee7d33b89e9e..b7a13e4c411c 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -45,19 +45,22 @@ struct ctl_dir; #define SYSCTL_FOUR ((void *)&sysctl_vals[4]) #define SYSCTL_ONE_HUNDRED ((void *)&sysctl_vals[5]) #define SYSCTL_TWO_HUNDRED ((void *)&sysctl_vals[6]) -#define SYSCTL_ONE_THOUSAND ((void *)&sysctl_vals[7]) -#define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[8]) -#define SYSCTL_INT_MAX ((void *)&sysctl_vals[9]) +#define SYSCTL_U8_MAX ((void *)&sysctl_vals[7]) +#define SYSCTL_ONE_THOUSAND ((void *)&sysctl_vals[8]) +#define SYSCTL_THREE_THOUSAND ((void *)&sysctl_vals[9]) +#define SYSCTL_U16_MAX ((void *)&sysctl_vals[10]) +#define SYSCTL_INT_MAX ((void *)&sysctl_vals[11]) +#define SYSCTL_NEG_ONE ((void *)&sysctl_vals[12]) /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ -#define SYSCTL_MAXOLDUID ((void *)&sysctl_vals[10]) -#define SYSCTL_NEG_ONE ((void *)&sysctl_vals[11]) +#define SYSCTL_MAXOLDUID SYSCTL_U16_MAX extern const int sysctl_vals[]; #define SYSCTL_LONG_ZERO ((void *)&sysctl_long_vals[0]) #define SYSCTL_LONG_ONE ((void *)&sysctl_long_vals[1]) -#define SYSCTL_LONG_MAX ((void *)&sysctl_long_vals[2]) +#define SYSCTL_LONG_S32_MAX ((void *)&sysctl_long_vals[2]) +#define SYSCTL_LONG_MAX ((void *)&sysctl_long_vals[3]) extern const unsigned long sysctl_long_vals[]; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 157f7ce2942d..e1e00937cb29 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -82,10 +82,10 @@ #endif /* shared constants to be used in various sysctls */ -const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 }; +const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, U8_MAX, 1000, 3000, 65535, INT_MAX, -1, }; EXPORT_SYMBOL(sysctl_vals); -const unsigned long sysctl_long_vals[] = { 0, 1, LONG_MAX }; +const unsigned long sysctl_long_vals[] = { 0, 1, S32_MAX, LONG_MAX, }; EXPORT_SYMBOL_GPL(sysctl_long_vals); #if defined(CONFIG_SYSCTL) From patchwork Sun Feb 25 04:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1424875dyb; Sat, 24 Feb 2024 20:06:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWXRRwzjMHZcYk9wYGtfBbrmnjkchR27JfJmBOY3MKO2LkVVUda+fgbGwjMrHPPxqSKoLsmfkN4V56i3jZRkeKM4KYmhw== X-Google-Smtp-Source: AGHT+IHWGJ3wdtHzHapbID87BQbociRYgR4wrYKqW7ydjs78J52gCrHHQvqoaP6Y4bQ/4lh9EORq X-Received: by 2002:a05:6402:3710:b0:564:9628:2e2f with SMTP id ek16-20020a056402371000b0056496282e2fmr3280546edb.17.1708834018925; Sat, 24 Feb 2024 20:06:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834018; cv=pass; d=google.com; s=arc-20160816; b=kWg9bWFLnUVAnVquY2jBqkpVIdUpa8gMMlSkLg4/HjT4nsCvOUCg5/ryiOHXF1xnFk vCMNb0CeVtJg45Kk7WG0FRH7s2fEqxwB+hQEwTuUq6/jWxuOMVrZKNheo10AK3NTRTyz D0YcbI6hd1V1iS0AvCkTGwDmqgi78+zWCs6WkBO8z3rjU+YLgUIU5wZ1t8fMSWi2KbJA 2Ms6Z7510Ws3RBHnEdDgzvqdCsAw2Io1LrdOtlyEswMPOCXz4okjhPGaUpXShL4Mijpd kLmGRcCjEltM6RnMELJ0Jfwgbpu99J94S8yF2EUtUyO3mudONwRtm3/hEa16s9B6usYH AQEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=kz5lRhDy5wWwgey/c2k6rCr2dAMwayc5iymGADo4jSo=; fh=PrhNi91pC5tGD7MrmUEmmnuIQmRhsbos7Ag6nWxwAhU=; b=aY5hVWRzPc6t6M3zriFt8dLFSo+Hx3cKm+JWYxzTXFy8cblNHkZ392JCJSKFh9KWTy m6x9Od1HlPCqwwdRuGF33tIazV0kRpNTBrlcyhIif7d8P2earntmt7KXOlgflSYL3yS4 jMrizwMgzsNBWECnmuBAgx/GvbSBbw2rmToujg3F8Ik8+LAfPY9G+bKRz1vwtlCEd0Ek qBGzc8vonunPhnaGZi5M4FJVXUme2UsJeS04KS1XXvA1Y6eqBMJtjYyrkNaXOaIePklL a43/NsnTyqpItkDRf8Z/HDk83hwRlru0PlsJb6uMRw64zzObOYwOrlVggdH0+kC0O3CO eOYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=gzfGNrbQ; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79968-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79968-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a10-20020a05640213ca00b00565afeb683csi781604edx.364.2024.02.24.20.06.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:06:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79968-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=gzfGNrbQ; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79968-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79968-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8C8091F21815 for ; Sun, 25 Feb 2024 04:06:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBC3C33E1; Sun, 25 Feb 2024 04:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="gzfGNrbQ" Received: from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com [203.205.221.191]) (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 0A2BF8F55 for ; Sun, 25 Feb 2024 04:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708833997; cv=none; b=LuQXC4cfSmyfzSyXbY58Zwr8kFvXbIP9cdg8BDtmRpR0QWbiuF7MvE33FBlEdhu2CgBC+FT4ung4EXGUftMbLsxPQadd5yyZD4Be/EjTK02sr9JJRlLHj9zN8hTM0E+pjZjPOQcmahAX7UGPEGqglfrc8Adi5Rkt4YDSz/PAzX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708833997; c=relaxed/simple; bh=e5AVl2ANYvMw9N2sa9FyVacc4tJHJrJOSKOahOrMncE=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=NOmxTkPSGHdQbCTqWrb3GTxmbItbv4uo8pebbnZZlnB6AoHH/zrsoJwEi1OIW3iisC6UHjhL4fjawfmh/o2KfkE7cdKJes5RHFH4wfzvXJ6QmnMOyoc7PC/2cegXSzBbBlSi/C44xSgill5tcUcyD9l1mga0rw/bLYxW/qB9h70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=gzfGNrbQ; arc=none smtp.client-ip=203.205.221.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708833992; bh=kz5lRhDy5wWwgey/c2k6rCr2dAMwayc5iymGADo4jSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gzfGNrbQrLQfxGpqUi3kyJOObNozSeKh0+SuDwY2wzUQ77pnPebWEXaLfuHTfnMqo jeQ8pLi8YibV7PiKeXun6nYSWdi5Z8f40uE5YrWtuREb2jFm90HuVhf7woKIoVwYvl 36VeRhhewqaDgogYZxxBSBfx2POw5ojH/TM5eiUQ= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708833981tm17norn6 Message-ID: X-QQ-XMAILINFO: MvTK+AXQ7a4FI67fVnk9OUz74OFyJLvk50+sgH3sj0llM/pitKfIOnKai3pgXx d+3RDni8PSTEcgoQ9KvJ+JTAymJ4VlkbSWmgEsrunFiJJVcJWeGIXOlctAGE7uymymcDddT4H347 tIRPeVgS2geeYp+6nH4psXGaklXTRP3sDRkaRwHw/ygagR0oQZmAy2EDMmHZpS6Pf3y6Y8PWei+G 61u774YEeiaRSmI0x54MAHrMxMn2rRBxXarkezVwVzEBKds1wDzF671WsjThSCJyvxcuRD8m+Ood GYqWF8oyF2VjLrBQnGyn2XSf8MLMm7xxstr+Fk/xa0CyU4yH+1+wJVTYqv8yFT4XG4CSXmF/0JWB P2Faocdx5W0qxzc55ZzmjjeUzQD0nTEAjYjVuHtnym6dzrbQoq4fdkg+fLOrqNLlULX7sH8bShC2 MrmGRs0a583gPrg+tA2SXydBRLGt6OwUZ8ru0qncgjblaRkvUQk9e/l9J0tyE9ummBP5GG89MLIe GX/d/8pPgGa6/eynEmVyMGipizz8MuFMh1ojS7Pg+Qx+IjsJgV3ZMPZcdvill4K77C1RylR7v6sA rVvmVeYrEzE9SAzmAPSNv0aKs2avWNJyT5q+IfV9aEKexUbY2bsmZINfQtdvxyJ/keSyXVIlOFPE kFBFg1wDqCEZWV+r7w+dSIrXA+JuHTsHz1g3B50KiQK5F9Ag0zP0DDJrMHUClKLSrpUMWyQ92J6x Y9s8sQHSA4UzOG4MKSfPs3nPfOvQlNTEF1/pIUejFg1K9bOdbLZlDzzCv/l5eK24z9rjxyGJsQLk TYJ9EMu9Q5y5eDUI2YN0wqaWmuCdsr0wCkyh+lLVzu7tSQxbhWLV7cqgz6GAVohSZ6wwlkmKRrHV tRhmeePFST51Sl94/btuB5Wm5dlx5KjeNufXfwAsL74VIOBjJJjcxYrVutui5K06PRoBwOfWH68U +tZdhdA5ImngJySh42JoD9T2zv340IlKF6U19A+wmQwzP6Ycp5EELlKdCmbejKHg+sj0eS156ZM8 3skNmb8y3n9rWo1pYYvFW8lkJUR3yyr3mZvXFp1A== X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , David Howells , Marc Dionne , linux-kernel@vger.kernel.org Subject: [PATCH 2/8] rxrpc: delete these duplicate static variables n_65535 and four Date: Sun, 25 Feb 2024 12:05:32 +0800 X-OQ-MSGID: <20240225040538.845899-3-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842340621072282 X-GMAIL-MSGID: 1791842340621072282 From: Wen Yang Since these static variables (n_65535 and four) are only used for boundary checks and will not be changed, remove them and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: David Howells Cc: Marc Dionne Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-kernel@vger.kernel.org --- net/rxrpc/sysctl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c index ecaeb4ecfb58..4e2230cf6ff6 100644 --- a/net/rxrpc/sysctl.c +++ b/net/rxrpc/sysctl.c @@ -11,9 +11,7 @@ #include "ar-internal.h" static struct ctl_table_header *rxrpc_sysctl_reg_table; -static const unsigned int four = 4; static const unsigned int max_backlog = RXRPC_BACKLOG_MAX - 1; -static const unsigned int n_65535 = 65535; static const unsigned int n_max_acks = 255; static const unsigned long one_jiffy = 1; static const unsigned long max_jiffies = MAX_JIFFY_OFFSET; @@ -86,8 +84,8 @@ static struct ctl_table rxrpc_sysctl_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)SYSCTL_ONE, - .extra2 = (void *)&n_65535, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_U16_MAX, }, { .procname = "max_backlog", @@ -95,7 +93,7 @@ static struct ctl_table rxrpc_sysctl_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)&four, + .extra1 = SYSCTL_FOUR, .extra2 = (void *)&max_backlog, }, { @@ -113,8 +111,8 @@ static struct ctl_table rxrpc_sysctl_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)SYSCTL_ONE, - .extra2 = (void *)&n_65535, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_U16_MAX, }, { .procname = "rx_jumbo_max", @@ -122,8 +120,8 @@ static struct ctl_table rxrpc_sysctl_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)SYSCTL_ONE, - .extra2 = (void *)&four, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_FOUR, }, { } }; From patchwork Sun Feb 25 04:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1424949dyb; Sat, 24 Feb 2024 20:07:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVn44JqEijvy3dyH55s1DZBj2uOWi1LXPtcb8VZ/dC8vAejZM8VoUmrEZVwva34YUUaxQPJheswrEt0uFkDYCQIyEvP8Q== X-Google-Smtp-Source: AGHT+IGZtU1JiW+Tjadeu+6aqpM/secp+Is0RRTWmQO6cJbtOgOe3waj0wpg97ZjaXKFeLFClNL6 X-Received: by 2002:a92:3646:0:b0:363:e82b:71c with SMTP id d6-20020a923646000000b00363e82b071cmr4087668ilf.17.1708834037591; Sat, 24 Feb 2024 20:07:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834037; cv=pass; d=google.com; s=arc-20160816; b=0+3YUww60KQfHcn9CRCkwh/RTPnOa6dNe8kSPlMMoJw5LrGIi0wN1bRMOyoHPsx4NP IA05NltYWM51NT0c2k1XABXVjA8q28+xFxPnhMSZYGnbWdUM75oOoj4f876Y+U//hAWs 9jwSLA4KDEziDAfrWH3UruXKqP3Mo/6thXASo66GsjKkB6mrR0zqDIzBbOEQ7fYcHGw3 nuh4+talynV/NuGc6G+CMWXEv37pL18tSiKLb2lekEBMpWw1oUmvReWjV5loacocfWfI P2P3+nZ0UeBmwpM4YCfVX2fjPOK1IbEkyhO412v9iVO3N3oE69+zlBBZVxI1+OnLJq+o prSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=lyd4BJhGuWqkAac72xN5ek4zfvslYVDWkTEArCiCrHM=; fh=gRLC4gLca4bkLA88sgL24ADNdiHmN1pE9ZWkE4mfeIg=; b=nNUl/jhLs+hAhbTBZSf5eVccQVhlRYyTPxY8RHNP4E246Rdc8QlUg4djaMW6qWknEr SABC3NWojGDSF/Tqf3PY3Ll8oxeH4lYjzih9UTH1z40osElADR3R8+KDV60U6YJEEH6j 1IqXVUU8PxH6DGvlYOny+EjHR0yIwfvJJexLR1kdEoN2OHh3R7tzSBdYw++mcMelpqIu IXyO0Rwwlv2u3L7C2kbFVGEeTU+xY76efNFNThtrJS769LAFnDfKrbSlBdQC0lGQ6+Vn 7Vn0Rq7EF0PklBsvf1hr2apWhfl9gxE3WW/fFgp7utUo+ENEH3zv4e/E1H0NGRHsGhDk k9NA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=FkmMbDvo; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79969-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bw14-20020a056a02048e00b005d8fdbbd5d7si1762214pgb.606.2024.02.24.20.07.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=FkmMbDvo; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79969-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9B9ABB21203 for ; Sun, 25 Feb 2024 04:07:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F31F9450; Sun, 25 Feb 2024 04:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="FkmMbDvo" Received: from out203-205-221-164.mail.qq.com (out203-205-221-164.mail.qq.com [203.205.221.164]) (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 8E65F8F62 for ; Sun, 25 Feb 2024 04:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834014; cv=none; b=i2xzJw+YmBlUjcQqfxG6LLtTlq7ueC53FQRF9/wpSzIN2Y8w1tCESo/j1eyCRKyjmbzVFmK+RC1h7BOlied7RIGs5VCPZ52BDKxVKTBPkqNDXnscMiBFjnimeifK3WBHmMq89gtpA4U8RSYXEh5prA9Cww/dat2ev9vgcQq4lD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834014; c=relaxed/simple; bh=nl6JrIjTW9p7TPesqi0hV03UyD+xxb/MCo2BW1hhADk=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=KEvPaX5w/ph5uoXKLPBvkO2Eq8PBHCvWQjM4YOnLP3Jqp5yg/K/Yjsr3776mYODF7LtmDqj60K3gzOWf0sTNB9AP/CHg4A0XcgtzbWW3PldJTfpw+to0l1lyvGLGfEmE5eDIZlOfCNFzzn/hsBxY+cyP/VfZLF1XKZTr03ytq7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=FkmMbDvo; arc=none smtp.client-ip=203.205.221.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834005; bh=lyd4BJhGuWqkAac72xN5ek4zfvslYVDWkTEArCiCrHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FkmMbDvojZ0eWmUnIg5V2SxOEM8mOv6IRIbtpyPpNnooJ18QYrbfwEMVL1qaZofq2 UIVtnFnfkWeojNHiIc/fMrv4Up1kJucrQtObPM2gH1gOifA25exToCkUvbtZ7PEDUs 2RS6gjDESzC/HsrzR2YRQF+puw3GNDL14XWnihdQ= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708833991trfqdn3cd Message-ID: X-QQ-XMAILINFO: N7h1OCCDntujmsZj7kv/BX/km4RTGT/ZU29tTDppZKQ5uf/jeKwf9fXjTgI4Hc U9DQZymPezehEusK6HO1/E6ei3QaFgURYHbb5yIYGF8SG6Et1kZej7Szl65jyYp9CyzFqC5Qv6mR KCNh17ZrCGSZb3vInOXirdmOuDPq6SD2Y7MMSdITDOVLseWILKYfD9iPaYpD8+7zKmXCYXuRKZzy MkEZAwtSO7ISe3KuEEeo6jwlOKv+MNQ3l7YRfEhi68SKUa5qrUm2PGnt+5Mjy5xbJITUMrj4qeNG iwKqq4OYkqCQKPvt5mpk6BzjSgQsCS7RM+gOP20GubVI1qtc9Wza3q5lo5M5wgx+O7lmlqxyoV5K Z1Aj9RBLn6lswXQYUypTTIRaPQT5DnLMCLTx1tHcktX0/kUDu8QrMNARna1mptSO4dtMMyY5YgVv zBef83J4rvN2HWr0C2RQTkAVnXm/quRtQFyiL3N0vL+cCXmIYECfP+Pr1mJo7ktuwlppq/I7Bs7P vabR0GqG8YqfwjJzRUlQSu/jbZJjV8EEr/mt3+kng1pcgMIdn/L7FXiGmlpYIxyL6pITa3od1xFY xhkGzHa+JWziGI7TT9qBZTYtj04l+uJAbPpv4E3dcxoJLIJ6q0LKlDKMyQZl41YNVV2jjttg1zLa tB/2e+txbsl5ZOvGLuQ6ymlN+xwbhCPyrMIHwdxGEFUvmZIDmWYwjWezhCDQ9SrSTCLVfJtAGPB7 B92XYwcQvtf194o1OCPLPd7g4C3h+Ooekqxkd0K+3WorVxQ7mk5vQ/Rz/BuSVlpDZWSiVm6rOArV 7Pl2YCrqslnkFq29IRRGIiUj/u+JvD5XF67wuzbgXKfPbmcWBTHnQDcuJbra7JQtLQbtBSK/dxKI JBj5VFNQqt0z7hwY5+Lq6b6teQ7p2pcp99igQYX3LM2sYKpgdC6/t5mMrM+HHh0APOo3Ypw2Iksv hL0CYM7wVDUYBrKnWrK1s9CdnYTpHPtCGXt0PcD2mCrwBRQ9oqZmBvkzLPyiFMJOqH04zKu+cBnJ ET5llkjQjEq9hIVwZ+a8q/GxHSCJp1A2wQzOw5jKPnTEGLGtZaOpC1yxd5G8COxzMjB2KCI6QSwQ HVVcnRjDagpQ80WPdnk+M/jBRF1A== X-QQ-XMRINFO: OWPUhxQsoeAVDbp3OJHYyFg= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] net: ipv6: delete these duplicate static variables two_five_five and minus_one Date: Sun, 25 Feb 2024 12:05:33 +0800 X-OQ-MSGID: <20240225040538.845899-4-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842359654754827 X-GMAIL-MSGID: 1791842359654754827 From: Wen Yang Since these static variables (two_five_five and minus_one) are only used for boundary checks and will not be changed, remove them and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: "David S. Miller" Cc: David Ahern Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- net/ipv6/addrconf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d63f5d063f07..1d55df7d34ed 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -6660,8 +6660,6 @@ static int addrconf_sysctl_disable_policy(struct ctl_table *ctl, int write, return ret; } -static int minus_one = -1; -static const int two_five_five = 255; static u32 ioam6_if_id_max = U16_MAX; static const struct ctl_table addrconf_sysctl[] = { @@ -6678,8 +6676,8 @@ static const struct ctl_table addrconf_sysctl[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)SYSCTL_ONE, - .extra2 = (void *)&two_five_five, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_U8_MAX, }, { .procname = "mtu", @@ -6722,7 +6720,7 @@ static const struct ctl_table addrconf_sysctl[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &minus_one, + .extra1 = SYSCTL_NEG_ONE, }, { .procname = "router_solicitation_interval", @@ -7061,8 +7059,8 @@ static const struct ctl_table addrconf_sysctl[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = (void *)SYSCTL_ZERO, - .extra2 = (void *)&two_five_five, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_U8_MAX, }, { .procname = "rpl_seg_enabled", From patchwork Sun Feb 25 04:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1425235dyb; Sat, 24 Feb 2024 20:08:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNDlh7nhImdsjPCMIV/smahNQea7rf8s+sh7+Ba9NCBLXYKdsPyhlsc8U3SVJZ+MkdOAjYFHCGDKy5pN6vtue2BalmYQ== X-Google-Smtp-Source: AGHT+IEGj1W+1ewUPtOc4TP31qgzMzM2A5lFjculO3GK2ERxrh//n58ipk1WrCxqX0p6me+ErLQJ X-Received: by 2002:a17:903:1205:b0:1dc:d12:193b with SMTP id l5-20020a170903120500b001dc0d12193bmr4645029plh.66.1708834117667; Sat, 24 Feb 2024 20:08:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834117; cv=pass; d=google.com; s=arc-20160816; b=qi/6ejuS7kxRK13pgU/k18JFgV+WXjXxWbXxv2KkHx/hqg0xZX9x7U3elvsKcneXUN 5H7wtB23zs7wspkF3d3IlCjfZXKxKKoTuyhj+3aesIvSqyMpEgB87/p7NDBPXFNPRsnp CvArAbeMcNtPAGryi/kaFel8Hy5+d2iK8HBAr6v6v4puLiTmKOFzM6009LMIm5ZizI3b JtnY9NS2ABC9bbIggEB9kC4YKYo8igZUi+pY3fqNMWyEosqcbDjWgjHtxLkm2/Z/Ugjr xuWnfAbTo4sgJzHOpnzDSiuPrTBBQLxVsHpUvd5E+4eOCYGEcnYUyZBel22uAM9622vx Ey/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=VLgh3i1HLl4qsZsnPo2rlFAeoCtuGCX5i0c6X8Lsfio=; fh=gRLC4gLca4bkLA88sgL24ADNdiHmN1pE9ZWkE4mfeIg=; b=DRk9Y1K/U2FF+aWfc4Pwq+tJ/1B0fDyrUxm3QI8MkXFoSdZIowqb6hmbroToSdLTEP XpbzZZ9u7LTnzS9Vmq3NmyJemrmT1TMTd13+Q9PLZwSwxowWcJT8Ti5BigCDXuWhOZhJ yJvplLxb0lPBb+IznfngEYS2V+OIZqdaJCm5iTtzo01ge3/WPaWz7rZELRACvK2WrOsl nazpnAcSRJn8xY73sezsj3ulFEdznOsB2kBlV7l7E4gKn7MA+GKvkMiMD6+J75m1q/rK 5xkSHTn0o5Gv/K7dy1tLys9H7Uy7qLb0I9At5CPxr8xKKkbGXyKCpSwCPNMk9TIWVq62 /12w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b="gx/nL4oI"; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79973-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79973-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b001d71de11ca5si1650197plg.493.2024.02.24.20.08.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:08:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79973-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b="gx/nL4oI"; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79973-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79973-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 78A29282011 for ; Sun, 25 Feb 2024 04:08:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D964946F; Sun, 25 Feb 2024 04:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="gx/nL4oI" Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) (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 396AD7476 for ; Sun, 25 Feb 2024 04:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834104; cv=none; b=dlSDOKh0u0NeYjqZK760/U68IQo3Z52ZVW3N2focZRrSGxjt4v5KB/2ks4PlWGp5KZTMJnWuJCyfGvdlasvezCbo/bOsG5vbWdYZhk7IWzHB5E9DXm3ex/DmLtZZsS16HzihEnSmtGrBrKoh6dUsiUtrxXfCfPOhMkfdPkdJtJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834104; c=relaxed/simple; bh=q4dKeuWe6W4Noz1+d/7Yfs/ZMDZdDCxYAicIx07p0Fw=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=FnVcC6xtrQDxUWPB8KuNd/JToF5yOOau3bFFi54Ku1aCR/UD0Zr+1JpsUg4CY5uCAEZeRn8gSvHL0ZyaUvqcHbjg1bGhc+SbFMaIZItyWqCm41nq0dwsRYN1SSEy7wmBCipEdNayvOxgt5JzNgNMOjLHtC//hrg/Byeakf+bbRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=gx/nL4oI; arc=none smtp.client-ip=162.62.57.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834092; bh=VLgh3i1HLl4qsZsnPo2rlFAeoCtuGCX5i0c6X8Lsfio=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gx/nL4oITRUCY3wlbj7biUDuf2rPh1l+GoqFgparHYAHxgESkRawhxhjSGlg3gDnU 3FV91cdnBwFr5xTVB9CIOhsgbgWYj127m+YgZdo1FOeXQJphM3k6XyIUnuvwWxSEy5 32FwJZeq991ZEcca2I3kbsD3DP9M3ZI10jwdIlWM= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708834004tx0ivesbr Message-ID: X-QQ-XMAILINFO: MyIXMys/8kCt9c0H52Jz366tiakHJ3gYHewk0A//04bB4zWcvxj0dGp5YbLv6C FGtFQ8Y/PXdjyK2qk/u4xSOuFL7zwAGNaOmhXXpV3IwXHJsAbiY/Di5b/G6kK4eUzrgyPrknbUWS UBr/IC4wtS6nAwFGBsnBEiDkexwhWmWKLoRnXj3ekg1cX7EYxleemBTi4dPIjOtf4zyX+i+4ot5W 7MQuhTDBfpQVSUkwADIIQv7SZVtyUg8cPu7P1ZMblMIaWjVHDKBRc/jD6mEplPM9bb7YaDIosqeq 1Q2JW2XUcWEifiy04qzBbUEadc11O6dhPbJ6TdHEG3/vLLTFSMtdlsExY214kPZtXvcErUTRf5Pk F5q7XC00fw4fSlKdGEhGXtNdhvnMPsa1CDI/QrkD68O6lx4Vv1pdEtclvH3ygKBrW6G6Gc/VITPR 4xwfIDSbwp0D/0PiZD2kK8bQjFbYBUFmEWDKrZFsB2hk/36MPOJ1EJhgztQiP2ePikJjZ1YkK6WF JSMh3RrN/+l2eeD0YxtlzhoCr5EG9Viky8379KlPNVMuagUeEgb80A07M5K6VgtXieqyypQXfYwN 0pbYB9pVyxD/8ITWyX5jf/EICKD+mE6LZvebLO/CHUNF1qD8+ryXRzMhCLCfCZdFFbcqkOXkk1hm i1MeMdO3UAzGxwcI5K6vyREUATt5AXgGP86Q4LCvBdM/cRmYiVrNcHuaM5WLIW6kVuxd7Wxr5NUJ vwdpn/AQOm+1mTowMxjvQOZS5nlGEGC6WnGfEKjy/yQEan87waQspiyH9HRVqxX/KbYyQ83IsZTw H5qmRLIA9UgBi4JLi9TJxrENsIEp2FPwcgMs5GkePXXBcJqzVQFpGvTJ2ITFlYxyrOJj1ilmRuzZ JpGdRXTmSfJkzpHbK1uoo6dgrfsgpagPeP2mPxQ1scqLYPR5xIrlv7Ik6kQ390WpsrYDKbB4Wu7U N8/+18UZl+IQNvC+6Iv+k8nmoxNdS981uZl/by0DZzdeVpRTdG4Hp8j56rZMfX9FcxBOszZvdYFn hLw6UdnTK7Ad/J2XEXXeQiOx4LC3s84hgZ3q5atCF6ZwzcdC+NRtHzMa0eSpkf8783YPkcHvmPlr tutj8l X-QQ-XMRINFO: NS+P29fieYNw95Bth2bWPxk= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/8] svcrdma: delete the duplicate static variables zero Date: Sun, 25 Feb 2024 12:05:34 +0800 X-OQ-MSGID: <20240225040538.845899-5-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842443748653678 X-GMAIL-MSGID: 1791842443748653678 From: Wen Yang Since these static variable zero is only used for boundary checks and will not be changed, remove it and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: "David S. Miller" Cc: David Ahern Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- net/sunrpc/xprtrdma/svc_rdma.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index f86970733eb0..5e4cd17eeb5a 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c @@ -63,7 +63,6 @@ unsigned int svcrdma_max_req_size = RPCRDMA_DEF_INLINE_THRESH; static unsigned int min_max_inline = RPCRDMA_DEF_INLINE_THRESH; static unsigned int max_max_inline = RPCRDMA_MAX_INLINE_THRESH; static unsigned int svcrdma_stat_unused; -static unsigned int zero; struct percpu_counter svcrdma_stat_read; struct percpu_counter svcrdma_stat_recv; @@ -170,8 +169,8 @@ static struct ctl_table svcrdma_parm_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &zero, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ZERO, }, { .procname = "rdma_stat_rq_poll", @@ -179,8 +178,8 @@ static struct ctl_table svcrdma_parm_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &zero, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ZERO, }, { .procname = "rdma_stat_rq_prod", @@ -188,8 +187,8 @@ static struct ctl_table svcrdma_parm_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &zero, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ZERO, }, { .procname = "rdma_stat_sq_poll", @@ -197,8 +196,8 @@ static struct ctl_table svcrdma_parm_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &zero, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ZERO, }, { .procname = "rdma_stat_sq_prod", @@ -206,8 +205,8 @@ static struct ctl_table svcrdma_parm_table[] = { .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &zero, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ZERO, }, { }, }; From patchwork Sun Feb 25 04:05:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1425059dyb; Sat, 24 Feb 2024 20:07:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU3BFAdBjEakGHOcKYqPdx2pIZg/Oz/SKwIi3dZjUw9SkUlDhsuhtZyY0x99PyxbJSu4YRN+lFflZxckWrY6ZYKqVXUaA== X-Google-Smtp-Source: AGHT+IGQMOwDEYpgvRvGcOuKFzj2WxI7hl9FLF+rLhLNbBgTf4uYt8Ky9xg09APTjUttXPCJWxZ2 X-Received: by 2002:a05:6808:48f:b0:3c0:4881:7a7d with SMTP id z15-20020a056808048f00b003c048817a7dmr4317972oid.54.1708834073845; Sat, 24 Feb 2024 20:07:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834073; cv=pass; d=google.com; s=arc-20160816; b=kpDV3P81i11FMBPR8MP7emJ6kFam3u8fSIsvXmoB7ZtijD2+7pGbCJI4s8OPXLdv8w hF6mXdl1XUrJwhxKtiE4t8iKaLGre2uys8giqHA+9o+iez0ASEta/YV/pS1WeTEEkqa3 XUgzaWNT+FQ5mYBK0TrRU5IBT+8i9rqwYw5Hy50F/CrNEZ5kNF7AhBa2asZunnm1HUiw Ts5ZNjaDQL37guHJGZh2FsIn5UIeadxlOoJHdWyuJ5VcNtlwaFAgY/OR7YX58334aAE5 USzm3ZtndwiDHz7O6vYsG3HI92zk74ISWstUvhw073kuJ2b1TOLdkwwkku+ZCeWg+O8F km8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=Y+FZfOgwRIGUoE4+U/hqrjcY1yVeyxZep1ZRA8BRMi0=; fh=8lPwl/J9Ju6y1lBiegXXCRnxqXfzndKCh3emlLYxrRo=; b=0sCweRntHA0UoF27A9X/dZXIlfpQWrzwLlxRwadxON4+LbtzgJ06O15wAL4MYg4xqL kz/psi0oBkvv2thP15bd+b9hT9uZRJ+ozuW/A4RWul+/pF4IuK2oRw6XRnTo7m3R1GvV lwjFiJDZq+VRXC/ngdEqCJZLh4+t9LmSzq1vTu/QewWl/AqOBAVRpnEcmn/Lk9JIzgDi 3yVbk8e426PAzClzgy9v5KPOcjeyBOvO2yyID6SE+Z4mAHp+wPdqQwYHaKY1oi+X5RQk O1KGpCZ7Y8OVetTLRObwHaXc+LpS0Ru0ODb9ccd8N8Q66Ev6dHcMSde2fWE+6DoOe37h 2rsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=q1GDrCw2; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79971-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79971-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h14-20020a170902f7ce00b001d8f24096f5si1648239plw.110.2024.02.24.20.07.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:07:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79971-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=q1GDrCw2; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79971-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79971-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D9501B211DF for ; Sun, 25 Feb 2024 04:07:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0EC7D267; Sun, 25 Feb 2024 04:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="q1GDrCw2" Received: from out203-205-221-164.mail.qq.com (out203-205-221-164.mail.qq.com [203.205.221.164]) (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 541F563A5 for ; Sun, 25 Feb 2024 04:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834048; cv=none; b=f+bWwLOD/GnIyl6PG/HdK94QhlAh/v3YSoFEZaqnueI4i7xvTHdfcY/XvUImcOOrPyfk2tB9zCnVUdNYxGosPcMoyONJMZd6RhdUXov1fnP32UqrMIL5D9zi/U8iOn9Kc2OLCdEglqOpA9WXzqf24+E3dK2mkDCJGPPkfDG8SLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834048; c=relaxed/simple; bh=n4omDxV4NCigiHoXtDZYmYa5GO5MOa7NnKVrOwi56cY=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=YxeYICiajmrvU49YJ2jSlrggv6A9kapzTJn4IfgKP1xuft/K7mCFsGTp0J/pbRyVkNkdG2u4yYza0R9vyTd9Lkh6hgKCTlfWWwWPlJBECV4Q5ojrYPcnFafwKh9KoQ13iLyw8Xaac9EBr0fwLvtpssOn53xTX7l2wTOBQFlHk8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=q1GDrCw2; arc=none smtp.client-ip=203.205.221.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834044; bh=Y+FZfOgwRIGUoE4+U/hqrjcY1yVeyxZep1ZRA8BRMi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q1GDrCw2/ByxMqZlAmH07DTvGp8RL6vYCE31G3MW1o2Del/O+DaOGYPkIF0yLPBO3 cyuw96d3SsKTyMte40WAmDHwYGIl7yEOKfq7F+6cjBo+pAXMcqZnx+ftCUwT02unMs zXfUcTUEwCRC0bafsY0oPJoL/XAVFgJ7ee7XY9AE= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708834024tkfqjjbuk Message-ID: X-QQ-XMAILINFO: NnYhxYSyuBnLa3HjHfIQsC2V4sWkk+PJiQspQqNqYaYaD8jqA8h+7n0t0RZgqo e1Us4DRjg5j4c/vpqJeIj07p1lJZblbZ+/dTQSFg4gtzXRZHd7dvNsQsiv+4xZszlbTSw8ko8zdN 5ivPHC/eCQaw89qYNWC6YeAvaYWGOF65ZZioyeOYhfjJJy1UWbVw0/d9sGsQsicYOvnBWB2ZPILC nuDuqCfbjNKDBb5BdRYuXx7BKJZ2wLrkVSTcnieuBs87eFc3Tg/fj4uY/bjz9AtyxjznSdd5IReT G/l4OJRJNyFXqFH3Mk8RrZPBSkM482A06AhASk6wojU1G0r2c6KgBjFqAObS+iJh5iXozN5ovbds gti8w1Ju9q35K1CbJRbuiKrBVSu0qO7NlgRwVi8mzk6NUN8jG8zTP5PIXS1+0tV7vcwTK8SU8Dvw Y7OK7vDlPTbwyNlgqnoEsiOwDJNTtnNMaR/QwCLZfgNm6+cEaIoHlFywkB5OMFPef32f5MBfupR7 sgmEP49iJ8MM44Ozp8jAfPQAyrstVFQLjgLnRe5K/nx4I5+3oO82xKvr+4RYfAgT/0sCQNErdXjp rh5dQBFJ5lln/S+vcP+nGWtdrCOZcztt2XLFGgIbPxQSP5KvbIQ9BPjQuHhl6S6uie04H491P+5n GjR6Iq7JJcCw/tjjvzL4qkagVL0blrYX3ADowfGqVfx7wyopct4Us0k6zJCzNBbuoAFpX3rO6aEm Nd5sVW72xfPUrv/4XY+bE4qqKgTdSVtzoCwo6uLp+IsMSTVsj4akeTKhs/fD7nhy17lcmu3sQznA F6YrTn5wzqslar7R4nhdkbeYG5i6v4sbxniNRzSlSMsdx3gox36gWWS6pvrOh1W7ptkU0dufZpNq wfDUHA/uSKq/UgraKKpqAjcj9nY7TDjZFVGNGymsyTD3SNv6qW0Qk/PsafS/NOK4hN1JnXRPikZt wwNFUREtpwmcWzVYtbcoFdpuj6BAxmQ8gu9U6dAnHsULcRIC/MsAGuCBg5gBOqw6R1n7se9q/WBI u8NzthVLMrV9xKIA0J0y9vvWXnf4TnBPzN8Y+fP3XO8eotxKMiQDzfHfJ+kJeLuPsHGNevmA== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , linux-kernel@vger.kernel.org Subject: [PATCH 5/8] sysctl: delete these duplicate static variables i_zero and i_one_hundred Date: Sun, 25 Feb 2024 12:05:35 +0800 X-OQ-MSGID: <20240225040538.845899-6-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842397833775314 X-GMAIL-MSGID: 1791842397833775314 From: Wen Yang Since these static variables (i_zero and i_one_hundred) are only used for boundary checks and will not be changed, remove it and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: linux-kernel@vger.kernel.org --- lib/test_sysctl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index 9321d850931f..ee69dd277a1e 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -26,8 +26,6 @@ #include #include -static int i_zero; -static int i_one_hundred = 100; static int match_int_ok = 1; @@ -78,8 +76,8 @@ static struct ctl_table test_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &i_zero, - .extra2 = &i_one_hundred, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE_HUNDRED, }, { .procname = "int_0002", From patchwork Sun Feb 25 04:05:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1425419dyb; Sat, 24 Feb 2024 20:09:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVX3bCe2gdLD3Vdc7wyw0enQPRTugTYBHNtOQ7mu8a+lhCRr5zzqnyI8Jqa62WG1Je6Ip7eTTnd6rYZ2yl/b8y99oM9yQ== X-Google-Smtp-Source: AGHT+IFuWPAqRe/vmf5YsGJ3fU6lIflt9rxUkc61hsfGuyl2Ox/DIZqOBFOhIkxIxozUrwsrrt2A X-Received: by 2002:a05:6808:218e:b0:3c1:9ac3:bf2b with SMTP id be14-20020a056808218e00b003c19ac3bf2bmr1183417oib.5.1708834155620; Sat, 24 Feb 2024 20:09:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834155; cv=pass; d=google.com; s=arc-20160816; b=Ruoig3CqDbeN1m6kCd1l4Ef/mHly2iiiXiikvvvw+Wt9Xqo4IskUeoBCTeRY9LVXL1 3opyFjsTLy2VhwL5fvdPvFsVHNz1AWI3NBi8TdEb34JOH5LUD7fgjrnRC28bG4u6lo8O 173JaovUsAiri0/wuo/BB91diiaSiFAH0vCsaXLrbheZZkdDHGSqBQ7SQ1YkHMcf1+vR ZpSKX5eomn7LglDmb+mAVMm3nwcBy/fLQE8OHIAd6Nqb8Am73iXKFjcqRE3pCScthPV5 nNakRX4aKb6uaNhiTnoYKRQZOpRcbpYObMxmH6WM1DHBAFm7PpYCPpfqU5s7u1h9FXSJ RBdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=mM8ldFl/qvZA4i5D0hWX4szQECAim3lPn4D9ZGUp/mA=; fh=NEMfMLsch2DUknLdEbE3a03BLaqynKzccpzrm0UOaU0=; b=lhBU0/JuR0fbdLwW8uJuLPik7qb3AhlDu2Iu6Dz6FTJVMv1Ew02s2ORRAlj4Dh1hkc oxAQ73iQNzme7NA6txJgMOCF0r7wbberAZUw8jxiN/FL/YOGqV6sOfpFEKonMI7PrC2q gPENk2lqxZTsiUXjhWIlV/hy8M7tM2fKgVnVhQ4/NOqQbDVnHCSxG53rPlP/Hc8ig/0t Fpvgj5HlLc/WANVYJ4rw7BQ1Oa/Wj9jrpeWi1+pynWpFZeJboTrvMYTNg3v8PQGOJZCn 5XFkfB9/u5QOCYGVbKkMtwJYroKqDqsvwvxoyh/qO9VmoOiZGd+fsYuGAslZ02BmHT0q DV7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=Zc5Tcx3k; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79974-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79974-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bp32-20020a05620a45a000b00787337f59ecsi2487592qkb.8.2024.02.24.20.09.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:09:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79974-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=Zc5Tcx3k; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79974-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79974-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6772E1C20CEE for ; Sun, 25 Feb 2024 04:09:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4DDB9443; Sun, 25 Feb 2024 04:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="Zc5Tcx3k" Received: from out203-205-221-209.mail.qq.com (out203-205-221-209.mail.qq.com [203.205.221.209]) (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 E4F9E7460 for ; Sun, 25 Feb 2024 04:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.209 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834142; cv=none; b=UAYbCWLnn6itYBGpiQPuVp73Cus/kCjEbWp9eIOJF1eR2PmBdNvnQ4TZM6qLpVchN6yHJUWYzm80zH5+lqOc2yx2MvmMDaCZiJ3yqk/+zK5cda8gEBduomZBePyJQaP2Ar7QmwlVxTWTZLxeWgrJWpJ+Dt+zKM4LdO9mCE9A+XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834142; c=relaxed/simple; bh=uomHFrNlcUsTDh2dhGspQ857QYmROGH5u+KIa214i3k=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=MVWswjPi9HibulKjH/QjY3tQgqf7/EbBbRLfc0npBNm0mLRJVQ1oK+lLZjbmI4QHB7+N2ymCrB/MF7wMS03bnk+NY2lgrJOB7U0+WtkrWP3HD+jICmkigMC6j0NAilongTFjRDKQlyuUrXhFGRR4dfHafImbvNRw6gR589WMMUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=Zc5Tcx3k; arc=none smtp.client-ip=203.205.221.209 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834132; bh=mM8ldFl/qvZA4i5D0hWX4szQECAim3lPn4D9ZGUp/mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Zc5Tcx3kZyC6FFGehKcfawDx5hTxHQ7ZwK3C7bmsAkdDOF0I8fbfm3Hf/iN++6mn6 ufeTyQY8q5fp5sTsK7n4X/S18yCf+sfpEChBpN74nW9Ln7REmF1fyqWI9W3RVitrT8 UIulKOJQ/shd6SFcKFCVV9MbQRzxeGwHS9e5eWgY= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708834043tmfqrrb4n Message-ID: X-QQ-XMAILINFO: NY3HYYTs4gYS1VwAnrDYUcZ7d0pPvmBjSTY5Yr6MGP4+wgDoV/3RwBtzqHPz8B 9NZCYvFMIyI72jHYNnb9P56Uf86eKkFzRQ0noga19bN2djCx32UBvGgjLGRGrrvouKBBJu9oimKx 8BP3SmPeC9gOV9w9LxchAJxqrGtdYYqqQ3IrO9OXUWuW200UYuKwOIt0+ZIFpDSHyYITVwU7DDbZ u/M2OLWoIgX4yF85YxAfWFg2Ah2ghe4P06FrNPDlRA+iZFWQ+T2DNP5+gXT7C3axgaK6H75yBh/m H/CGgtNMmAxGT8JTgqTtOraONBWz6URXCY8Y8MFqPmu55QtAYAJPiMbCxZLM3ljw9ACq1SArSJPO 5O2S+sOEfh+I2MYP25lKKMF4Iat7EOl/zP6O5VptE1VIKFfx+Tq4QGpIomFgzIh2o5u77pOu9Yjr dnqZI/2R6WocdX/x0FdLg1slNzXkgsXniu6l97TSE0UTBQ/V61B4EUjNHMT/QninsoxrWiXYFaht tPrbfUp53t/RzDzMeeWOvzDEzoCuWXk79ys8O9Wg99z0RwVN/QSAUqZFMAiYqJbsFb3U0/wAwBl5 83HgpdMyq6AergDJHIhVrzGCRLMhMvCQaZdAACP6Rgu+EEk2kUj1cCudm+xCxnXJfnQuMpzGdMyV jFVgLVzHFaPbZ+8gJFR9/7DQHcDb/fANpkxMpxKv/6LLpCraJV2rtgxEVX5DO4ok4WSyS2r/DQ29 os759hbWADR5ZyxzTrhaGpoSzEzoodl+GjSMUOGT8l+00hbonx6EjeiwNefySxpp5bFnz60R4mco rbKrEbHf1gBW3pBRZoNv4EsboMKyVZRyivgYJjFyu0/ybjuBBYW1vELhVCcuynymBMCpI5CZ7POo UVXX/Am5BCMnAVAJqJGJwxMMHFhYVipeID9fCod9wBlhf9CnUK1BogWbouEI+C1tQFOnHeY52A2D b05nJPlSC88g2OvDJoH/nRKI5etIP8d/LHTpB+MDmzls3YFC8gZqDSVpZOe6raP3UH9rQpV838iU 6U+Sc2xZiT87K2zyBX0vSqPUNLblm9Emui6U3QW7c2kvgnwO6WSlS6lx4p1NQ= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , Jan Kara , "Darrick J. Wong" , linux-kernel@vger.kernel.org Subject: [PATCH 6/8] epoll: delete these duplicate static variables long_zero and long_max Date: Sun, 25 Feb 2024 12:05:36 +0800 X-OQ-MSGID: <20240225040538.845899-7-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842483526303874 X-GMAIL-MSGID: 1791842483526303874 From: Wen Yang Since these static variables (long_zero and long_max) are only used for boundary checks and will not be changed, remove it and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: Jan Kara Cc: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org --- fs/eventpoll.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 3534d36a1474..22864d6de04f 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -309,9 +309,6 @@ static void unlist_file(struct epitems_head *head) #include -static long long_zero; -static long long_max = LONG_MAX; - static struct ctl_table epoll_table[] = { { .procname = "max_user_watches", @@ -319,8 +316,8 @@ static struct ctl_table epoll_table[] = { .maxlen = sizeof(max_user_watches), .mode = 0644, .proc_handler = proc_doulongvec_minmax, - .extra1 = &long_zero, - .extra2 = &long_max, + .extra1 = SYSCTL_LONG_ZERO, + .extra2 = SYSCTL_LONG_MAX, }, }; From patchwork Sun Feb 25 04:05:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1425456dyb; Sat, 24 Feb 2024 20:09:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWBu7D/oFh8+RM9LvejzeCT1F4Iq0T0DoaeywcoDH7nQDlhVIjJPGnXhUFlB7Nl6yJe/xr2a0gfQe+2c7KoSJrJYSitYg== X-Google-Smtp-Source: AGHT+IF6Qg+h1cF2f95z2AfQ3F8ucsJbGIhyAtewyrd7gI1R2+To3+kpWU1MDjdwVPYy0w545fIg X-Received: by 2002:a17:903:2291:b0:1dc:6754:52ce with SMTP id b17-20020a170903229100b001dc675452cemr5212126plh.60.1708834167983; Sat, 24 Feb 2024 20:09:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834167; cv=pass; d=google.com; s=arc-20160816; b=yhd9l1cEeCJdgbvGp0yJtuaJqxoZp2EZX/Pice9ZoPMw2rkXICi0eS2hmAedR5agIP Ywr9zc1j7LyW2o048y2sKN8VflXcVM3p/9v8Q4rxDtwKeXVN69f77XKKXbt9uctAnv2d Aa0tPwFGJyzpiAjnltRz6i2Z2XgHGqr+QPgw8eCGZY7XQ2Q1NlYekutnjvJ/LkQyQOUv XV97XMqX4iGVtDh6N1koKUDWtKzfxCighfNxrnKWJSWZypOY9xSFrLrC408nRuZBGrPZ 4QTlpRXFwYUUJAgR4RMUo5VyNbMSq/5j47vXjCQamGQWJR6UI6LliZFXcm0KS1fGu9oa Ekug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=l13WUrrxIXOx/AaiCG+3OUvZIiXniioY9+G9KsMVcKc=; fh=NEMfMLsch2DUknLdEbE3a03BLaqynKzccpzrm0UOaU0=; b=yuOAiqpKGSl9KSaXYKKMuoh7TmC43d3PB8bOAJKjZZDEHtCPj04olBG0fnLo70qN33 zT0mdVJjQlCy29+WaUbXGflQOAw6W6pBXXyYiDkFjVKgEpz2+YOCiU0XLOYo69bbFcQq swdRnTFSIyYdF7fALIVu5+Ja05qTPxyBsWG5QJMTNKM3iuKwv5XNI3LGVQpDHr5puI29 SPf1w7QXf45miy49HYUa1d4L7l8q2T7OnyZyvtiOcw96AVLuLbasz3kpGIrGwdyathoq rOWCGsEZh58CHSMjML1W6zfug+9x9BdjBwXOyHclys/aQGrzxj9zgO/4B2JnqTxr6fQn blAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=oyUQ3gDV; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79975-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79975-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e17-20020a17090301d100b001dc41a37400si1652678plh.343.2024.02.24.20.09.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:09:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79975-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=oyUQ3gDV; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79975-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79975-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CAB06281FE2 for ; Sun, 25 Feb 2024 04:09:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4678CBE4D; Sun, 25 Feb 2024 04:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="oyUQ3gDV" Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) (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 D748D9454 for ; Sun, 25 Feb 2024 04:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834150; cv=none; b=keh7kaCG/K25lrd6D7FKqV6ZUSXN+CFhPz4rCvkEPmEtD8vaZuG813TbvW+x4GOWyQzm2mOK1esjG9+YT+tvMcmUGm9heDMhnSyEDB8X1wq6Jspl+gsgXeeemg/RKn53Mq6VLqzV+j/urB/4gjXU5o1EnRFhXUUKVBMRkLCADTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834150; c=relaxed/simple; bh=gT6pHr6ol4g0hx+y0gQX0e1TRgLEPuqhV8V1nhgaMgA=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=tFJU0OfgdxE9Cgf4ttuVyawRVU3e0XkNAdQxxS5dHk99Z1FA9M2AIo+LGUT6KH4hGuidefKS23bJFPf7zaVQjiidcMPAbkqCcdG9DyhSCRGF8EOVi9GU7MtkHsKbbQlDzz+2+U6UwagPeE6S4rhOemlUjJ3d4U/rHJREcDKRqAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=oyUQ3gDV; arc=none smtp.client-ip=162.62.57.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834138; bh=l13WUrrxIXOx/AaiCG+3OUvZIiXniioY9+G9KsMVcKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oyUQ3gDVXZqLC+mm+glQXeLGd2mBN5zhCnDssLa46I17MHluFC/p2fremH5tdbFRC MwhuB7RWXYFslE/yiLZvCABoLGcZ1I7wxXsGk7js2wdZRfWwpLt81GVml/nr7u5L+u CaL5eotO3ADvzwa0RH2E2fBeTUuKek5HafTy/gHo= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708834055t1cx1lrd7 Message-ID: X-QQ-XMAILINFO: MJf3YPW6EzbKUsrbZkpQUE6MXr2IXIV0tvZ+QcMyNSn5ZT/4QOJ7wpjMG1q0s6 10vK0cUOqOQThBAVtOzashjbIT0JRqmohIXkV7J+Z8/csouKvsuzs9JCDDoj1DnCk6dbnR9TfAMv TELPb9QdwK4RQ6cNnLlVQKsw+7v8LfjwamHE/S1aLwJG77Y+79mPpP6fczsDSlMEsDwyN5Q6J9K+ IYM6OAZtmY8rZOWnKbXbf/i4CdhTC6px1uIoFOSbN08HAX9509U5CiO/egVXejmNVPg030G+Pgjc uQw9YDqKZIwCPNOSCp2R27In4bbNnEup2m+q3kiJo4lCeVOlHIQ0G0NVAm5qJ43DAR8BJgX8xJtc fHOygHZp+5O0LrcDRnkg/Zn9vpcWO292UgiX1TRbqvW45Iz0IgMVmo9evc53r46sJxH6slmySaSW ciMhufPAJhZsj/ds3Q6kZJOGbHiH28DgdUOvx2FbQN2JKh/Q2Zq6Pr2N1nCsJp2az7R+QXZlsH/p bkY4EssZzzN0hRojC/IAhLLiC1sT2PPdoL8xTFINGNyNkyjd6j9E4tYuLd5EKmznZHSw3JtwJLxt vp/PlsJYcKKY4q3khH4ubWsICMqoR/Gnp1Q0my5n5SIMdePcfHRGcOef0quQJ/5fyHmcU1D1iC+l VSPiLA2q67faI3V4hRgxnW5b6/EzVrk6m6MTYq4EnzAPizuRhGHaV1nWl7LYaNjliO6sPuin6pJb Jno3V/+ZZnOLujOSNdPMxIS6Th/+/GpYi8eKTSHDBfMSob+jx/K+FDkPpULzTMrn+Z9dZqRJO7XN 7X801YgTnzbfCwUc700yb7mkhDxuPm2vCXNUIQkCoyuxrXXFByfT1gFsyrR5lO/dLavzk3DsJI+F 9zPT6Rvsga5PI3+hoUG+71umaxh47x6O9TzSVdHVSAdDC10RwJB2oMzSToL+p663c+YI1fKQWk2Z cd/jvKlZKiWRAJmyO/T9rCKJ5n59rTYYc8e7XHSQy1VrYGcoWXxDPyjnDlWK904QRKhW0kJm9WqX Iei45zWSuJpWXZioOWIflbhFIOvboc5MtotZs8OtUyHY4JT5SElWPzm0WYqkKQqBVO6ee+8PMK1N Yt9zN43z57hgjMz8c= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , Jan Kara , "Darrick J. Wong" , linux-kernel@vger.kernel.org Subject: [PATCH 7/8] fs: inotify: delete these duplicate static variables it_zero and it_int_max Date: Sun, 25 Feb 2024 12:05:37 +0800 X-OQ-MSGID: <20240225040538.845899-8-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842496715696483 X-GMAIL-MSGID: 1791842496715696483 From: Wen Yang Since these static variables (it_zero and it_int_max) are only used for boundary checks and will not be changed, remove it and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: Jan Kara Cc: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org --- fs/notify/inotify/inotify_user.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 85d8fdd55329..fd5c00ed8559 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -55,9 +55,6 @@ struct kmem_cache *inotify_inode_mark_cachep __ro_after_init; #include -static long it_zero = 0; -static long it_int_max = INT_MAX; - static struct ctl_table inotify_table[] = { { .procname = "max_user_instances", @@ -65,8 +62,8 @@ static struct ctl_table inotify_table[] = { .maxlen = sizeof(long), .mode = 0644, .proc_handler = proc_doulongvec_minmax, - .extra1 = &it_zero, - .extra2 = &it_int_max, + .extra1 = SYSCTL_LONG_ZERO, + .extra2 = SYSCTL_LONG_S32_MAX, }, { .procname = "max_user_watches", @@ -74,8 +71,8 @@ static struct ctl_table inotify_table[] = { .maxlen = sizeof(long), .mode = 0644, .proc_handler = proc_doulongvec_minmax, - .extra1 = &it_zero, - .extra2 = &it_int_max, + .extra1 = SYSCTL_LONG_ZERO, + .extra2 = SYSCTL_LONG_S32_MAX, }, { .procname = "max_queued_events", From patchwork Sun Feb 25 04:05:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 205988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1425167dyb; Sat, 24 Feb 2024 20:08:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUVq9iMyqenK0uCMjoWABwLjcSGD+UFToaPb9XLLS9XNAPSdLmC3xONvjiSXNdsLUyUTJD5app+nCLMDBMENfu6nq286w== X-Google-Smtp-Source: AGHT+IETNJSH7XRiaInfr+c6iZrFr0wqMA4rtB7EG6L3j5UplAFmBK2puY1iLnrBMFhvGpMEpuSC X-Received: by 2002:a05:6a21:3512:b0:1a0:a091:ee97 with SMTP id zc18-20020a056a21351200b001a0a091ee97mr5728154pzb.19.1708834097571; Sat, 24 Feb 2024 20:08:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708834097; cv=pass; d=google.com; s=arc-20160816; b=kaTsiwJMgLlHxNJFSn6C59ILivvYE8BeUuPz8ZaAedfkEzb2mN2VNeJSKFxDdvstav 7mUSPQ3c+iQG8ShmqLox0rMZNhOTo6hoQ/AfiqMy1Eia27MPleKvwkf+8w3goBniU1Xx LWbMZZRrRrsB/IWEVhcVO92bYh28Cs99w3icnA2fVaze+o6LL3kmJfNQi32I1U0KsgZY RcE1DwuZUOfzDjtdBgOG0wDwH+avufVaty6ysi/49YeNtVe4vaqMgUWLSTUHq2rSXA1n OU4PBqx/tTHIbmHMsBVD7QDoUU+SzMSWx3fuvtpBjKTG4IE+dsuks2sEhtKqanKEABLQ 8fOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=QzjzGYwHl8mJJbJ/GLAvGi7Pny0jhSARgE05jH5zKak=; fh=VClCbdleh3D5sabtQ0BRdkkta2krUeLv9TtunNGfjzw=; b=AGK3+AJBB1Xu1+4pTwBjwUM767FdtZWqXCF8MXMefXjDYw/yLQWd1euX9YblsixbAD jBMx4am8/4UER/Rrd1ACBEd0j/Us+G2y6YIoOEwawDJD4MoAwbncfgjwRM91k4L99H2H WvL9VIoZprxhOCVj3XjhoKEG5znSjiKyIj89d6W1udjDSBT4YfRATgooC6NSSWqwB6TS 097O1ncq35i2C+jW9mtvgNTAVKuinflMO3IfCipgEy44E4fcUY13PqTqZuILxrLIQ5Gf gq86UXhsbCEKBXPGNuSiCVM6wbko/J2EPVr1XMAjyh78TzbLls1a3+tUBYMebUiuZff0 v4QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=g7oQi2Lo; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79972-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79972-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i23-20020a631317000000b005ce05e5d57bsi1718260pgl.574.2024.02.24.20.08.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 20:08:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79972-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=g7oQi2Lo; arc=pass (i=1 spf=pass spfdomain=foxmail.com dkim=pass dkdomain=foxmail.com dmarc=pass fromdomain=foxmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79972-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79972-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4CE87281FEE for ; Sun, 25 Feb 2024 04:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 370BB9454; Sun, 25 Feb 2024 04:08:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="g7oQi2Lo" Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) (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 D9E808BFB for ; Sun, 25 Feb 2024 04:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834084; cv=none; b=kmvH3J90Uqro/ogzXWklmcWZhlR6PG5NJx9pxOZyxfE+ZS95vQugt8rebPSh13NOBmO/diMfreOnBMXrDUeG4OimqZxLu1hfNYyNNbi7jYS3GU/9V8fINYb6IKXhKKZb18hRKJ4y+vkl2Gae23Henl+YmMBtKayfuxuZvDbxVZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708834084; c=relaxed/simple; bh=x/f9hZGAQVRLuG2BwE0elvw8ixnOBltGJfsVT75HSnk=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=efhg1OcyoXPvSVXun0nvY2dGKk6FUIojD1cXrPn0abJ8NWgid09SYjrK1C1y0K68/ey5CLEFLsPIwMmFwOltWF04dgSYLtLQ40ajnqU9atTMc2ktx5lPg1bFY7sAtq/4JWgff5JHllGhSNCHkKXrlx/JzZD7cpDPTtJHK4gY4HI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b=g7oQi2Lo; arc=none smtp.client-ip=203.205.221.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1708834080; bh=QzjzGYwHl8mJJbJ/GLAvGi7Pny0jhSARgE05jH5zKak=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g7oQi2Lo8n3LChx+C58v2YnIuB78Z/R12XvbbRDjg1mP54HjM7ArkYGcGCBLDdk3N +KiZiHVSrcEgkFBDLqepLY/KmuMCKmMZoVfwwcjv15OlDJrj/CEh+umwNbBSbV8LHu +rklxbdmPLlbH8dYRNySJLgC2OXv1BI5CUszT91U= Received: from localhost.localdomain ([2409:8a60:2a61:ef40:480f:5c56:cca3:1b20]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 18993038; Sun, 25 Feb 2024 12:06:09 +0800 X-QQ-mid: xmsmtpt1708834068tyhcili55 Message-ID: X-QQ-XMAILINFO: NKv2G1wnhDBn9jo7Y+wGMHn4Cejd+6lIIpJjif/4BEgTLgOjckXFcGjoDKyz06 6eeI1CQqNbfXL8CQbXRgrGSpgIigpvFhISz974yeFiJ4tkAvBnYtN054XczNv0h6lXBlVfGenCej NYUjMs6RP1parsO18wchR/wriSfnHPGbUKhYC891VybbdEGL2N4K2bq0z21+p6KDJLR6m5iKy0hW PLlvSRXg/01OrD3pPKvCc1+XVW96crg1eLY9vLdUFAWa9bp3U2mRz1Wff+fayfuCQXMaEYo1Gbv5 2dpFD5lZkLllWmtV7Yjh6sx00GamhJSc2vOSsHaouyceRp1cDwAlfkmHSIcNaGX9+yXK+AYmnOdc 2IUFaCEcKGxXcEaFEdWdV5c1JdFXUgV62NaYQQ0FVm5m5nV2JQh5H7TS1K4Ugy4D9pEmlYB5t2kt nhJ8w7ytVjEvGntmN8nRDQ0EJwOY34/TeNagW3AieKV/ytPhIahX6IhceYccKneKcpiYPCYyrgN6 k2hdPVSj3tz8X9lT/NPnUUQlBy0NlUmSiw9tV3RgfAnO1RW121D7C4x3VdIEzbOB4I3ra/wOr7Va nZj1nDb7hD6l2RGMb5NxM6rT3fMFdDfW+BFqU9t6zqbLEbuB9aZBh0HPyOyzml8ILG37F95nCIBh dJGIyMUdtrnn2chinEzdXTWxIEdQf02kn1ZB4Oszf0tVHWJalmovGCIz2aolmIpVb5yGmoRkSccJ ILx+vhS6MWE2cEmngRbJk8aPeOpRLUryk6z/4C/01/hVrpfwIhHfe+Wsn/Q4Oa28zRsQKVLqG455 dJOOFf4w1zQJHk5BmdJ0dBGjQTZzFoQ3eiQbk+crZjDAkZLTu9W4/oZR3M/2L09GKdP95woSQQ6O /2aV7g8laid6ADavbhnqZaMmM0Kd6IG4zqbFWPYrG6D4D0e0yKBE6CV+qtZ0URRyUHjOc1BuEWNU lPubllW3fUEMwCtcRngw/Asj8z6L/2vLb+fZmZIfw9Eeds7dkvI0SPB1YutY6lIVE2H8tYl/QH8m gcBRV9zrVzcLKDsGaUJ3C2nPogoFA= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: wenyang.linux@foxmail.com To: Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner , davem@davemloft.net, David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wen Yang , "Eric W. Biederman" , Shuah Khan , linux-kernel@vger.kernel.org Subject: [PATCH 8/8] ucounts: delete these duplicate static variables ue_zero and ue_int_max Date: Sun, 25 Feb 2024 12:05:38 +0800 X-OQ-MSGID: <20240225040538.845899-9-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240225040538.845899-1-wenyang.linux@foxmail.com> References: <20240225040538.845899-1-wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791842422394097615 X-GMAIL-MSGID: 1791842422394097615 From: Wen Yang Since these static variables (ue_zero and ue_int_max) are only used for boundary checks and will not be changed, remove it and use the ones in our shared const array. Signed-off-by: Wen Yang Cc: Luis Chamberlain Cc: Kees Cook Cc: Joel Granados Cc: Christian Brauner Cc: "Eric W. Biederman" Cc: Shuah Khan Cc: linux-kernel@vger.kernel.org --- kernel/ucount.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/ucount.c b/kernel/ucount.c index 4aa6166cb856..05bbba02ae4f 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -58,17 +58,14 @@ static struct ctl_table_root set_root = { .permissions = set_permissions, }; -static long ue_zero = 0; -static long ue_int_max = INT_MAX; - #define UCOUNT_ENTRY(name) \ { \ .procname = name, \ .maxlen = sizeof(long), \ .mode = 0644, \ .proc_handler = proc_doulongvec_minmax, \ - .extra1 = &ue_zero, \ - .extra2 = &ue_int_max, \ + .extra1 = SYSCTL_LONG_ZERO, \ + .extra2 = SYSCTL_LONG_S32_MAX, \ } static struct ctl_table user_table[] = { UCOUNT_ENTRY("max_user_namespaces"),