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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ux@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, }, { } };