Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp971867lqt; Tue, 19 Mar 2024 09:04:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgCX1bwGqfMAzyWakvF0rjE+/ixYO81VPwi9qo0E7MzOcX9F13QKhnMhTEWiiq4JAC4lURBqpG6apVUKpBRhL6xmzXDp56tLCmRU8bLA== X-Google-Smtp-Source: AGHT+IFSm9yAVQFa9JGy8gx2zEGYiw9r8PkxthX7lKbAgy1KMK2UaTlisuO07SK+sXgGwNF4UJmU X-Received: by 2002:a17:903:234f:b0:1db:c390:1fdc with SMTP id c15-20020a170903234f00b001dbc3901fdcmr15471109plh.1.1710864285939; Tue, 19 Mar 2024 09:04:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710864285; cv=pass; d=google.com; s=arc-20160816; b=H9y/8xMg11Jd2XsHopTBPhRZKaOvIDzGCnisT2i2k6w5rB+7WMALlElHT3gIu12LdK wjN1Z7GioQ/pOXozHNF+HqXfcS2KLdKEyRcf96JnEp7Jfs6YPie17fDkoIWbJDl11wVo 1o86CwQKJbLbEsNHXSJAHCSkgKh76wefDunw+EKW+lHRHCXU8YzF2faa8CPFTRXyIwBl RPy5LZDBzYDQG8RcsrPZ0M9yEm8gPIxJn8mkUUmOX9Xcqr/k+bYIcnlZyEWtUWChdLU3 y5WJKpYmr1YwhdUb5GGLAoJMx2ObrIIfEx8J+a+ZtP5ILxqYpW8xnBg6mkKLYnF/q21s +Lew== 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=SSRgMEacKlRgTzt0buSQ6sVgqkbUDUraShL6rUZA97w=; fh=LVxZgGtvX//CxbUYLYwXfPLzY2h1dL+8kaZIaSRq0jE=; b=l76/zt5ae+/JA7S4qqE2JXdDQW8UEjeOjWD1JSYuILRNyuzvhn6EhDDEHNzd6LPiCx SIbkx75fwOzsc0tUyXixQy8gYX6+dAj8jNIvAtNKiSK5TTubp9+3YBUjcYi9zBd9NHTd Oou6fVHPyt0V4bRIIj1KH6PowMFcaVvYllNPUwcxQZsKXwBdA/UU+/QJQZkeeVyokFgO IVg3GF6ABFSW5X+Ltj/a81pBlHdIr+BOwN/Yj7KGNbI5U8kY0IjF75ku2xG9xJcCR1Wm 0sAWowQtyzoG/XELw2oqKIrZR1ZZjJ+b0VHyI8N22SzuYtDDbFxqGn210wQnIpdpINxw 1Kig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=H42Oog3J; 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-107756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107756-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i3-20020a170902cf0300b001e0006bc94bsi6660677plg.290.2024.03.19.09.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 09:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107756-linux.lists.archive=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=H42Oog3J; 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-107756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107756-linux.lists.archive=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 C922FB243EA for ; Tue, 19 Mar 2024 15:59:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AEB8823A9; Tue, 19 Mar 2024 15:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="H42Oog3J" Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) (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 E80E781751 for ; Tue, 19 Mar 2024 15:58:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.252 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863932; cv=none; b=TMKShGYQ6+N2UjocKi8/4q5gSJSqV6wrKnrd5TNYBSAx57pFqRuWkF3jlYCBPwYkjD5d/VO+gtJG5dGgEDrL6zdWq/uoC24OnYu9tbUVZ5aJgUaoCABag9ZjIEiQquOroB+fLMLnYGK0zHgk3ekl3yQOR57BC7/BgDgM4q28gHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863932; c=relaxed/simple; bh=NJKqmOHNR07G45d4NVjLLw9EdzmYl7F7Ce1i+WlWE7s=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=Fz2lDevgSUkgBnNnX/F+N9BqKYbIakTIPJXTU4TaZgwquDlksbdwHr0UXLcy+cC3Z32P9Z3LoaQfH1+woa9n/VGOr56FSLyjv/WkP2gU06kQOj/skeRJyTf75yTdGorONPxjwL+HRGpN+dJGFlT1oG8MR/P90mhrPDYdbQyblqU= 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=H42Oog3J; arc=none smtp.client-ip=162.62.57.252 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=1710863910; bh=SSRgMEacKlRgTzt0buSQ6sVgqkbUDUraShL6rUZA97w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H42Oog3JZmOUyYo2WXUBTd/BJuVV61TmmkX8p2AmX3p7OH1llUVnfFdJR+3quTg3J mGpj89hHnImApMBMWFSgUSp0jeP/nV/E2unD4EAa+fZol9v7uQdzabcbGDUQs1T43A 5zaWM5ROGqRX2pR4DMPCJPY1kHjFtO3dC+dUn4hg= Received: from localhost.localdomain ([2409:8a60:2a60:b160:1774:d6f7:f5f5:b6a]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id E8996A1C; Tue, 19 Mar 2024 23:58:09 +0800 X-QQ-mid: xmsmtpt1710863907tkw3j3e32 Message-ID: X-QQ-XMAILINFO: N4r4IakIsd1kT79Um3d7vf7jax0oEV0tm7D+7SWORBgZarpWSs1xKpq8xqUxID QilmcOQNQBVY/A4GbqBajlE4fEwG0F+dK448aQWSuq4LENMtXO24FMdzu6s8US10ayWJKoB4f2RS acZpD3ndYE9zZ/GEjrH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ain , Kees Cook , Joel Granados , Christian Brauner Cc: Dave Young , Wen Yang , Jan Kara , "Darrick J. Wong" , linux-kernel@vger.kernel.org Subject: [RESEND PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max Date: Tue, 19 Mar 2024 23:57:49 +0800 X-OQ-MSGID: <5d22ef6abad560669516fcb0bba943455499ce58.1710863674.git.wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com> References: <26c450f6467b4cbaf94cdb10f047abc6ab0c2a5d.1710863674.git.wenyang.linux@foxmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Wen Yang Delete unnecessary static variables (it_zero and it_int_max) and encode them directly in the table entry. Signed-off-by: Wen Yang Cc: Eric W. Biederman 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 | 49 +++++++++++++------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 85d8fdd55329..b346d61179ea 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -55,36 +55,27 @@ 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", - .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES], - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = proc_doulongvec_minmax, - .extra1 = &it_zero, - .extra2 = &it_int_max, - }, - { - .procname = "max_user_watches", - .data = &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES], - .maxlen = sizeof(long), - .mode = 0644, - .proc_handler = proc_doulongvec_minmax, - .extra1 = &it_zero, - .extra2 = &it_int_max, - }, - { - .procname = "max_queued_events", - .data = &inotify_max_queued_events, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = SYSCTL_ZERO - }, + CTL_TABLE_ENTRY_MINMAX("max_user_instances", + &init_user_ns.ucount_max[UCOUNT_INOTIFY_INSTANCES], + sizeof(long), + 0644, + proc_doulongvec_minmax, + SYSCTL_NUMERIC_ZERO, + SYSCTL_NUMERIC_INT_MAX), + CTL_TABLE_ENTRY_MINMAX("max_user_watches", + &init_user_ns.ucount_max[UCOUNT_INOTIFY_WATCHES], + sizeof(long), + 0644, + proc_doulongvec_minmax, + SYSCTL_NUMERIC_ZERO, + SYSCTL_NUMERIC_INT_MAX), + CTL_TABLE_ENTRY_MIN("max_queued_events", + &inotify_max_queued_events, + sizeof(int), + 0644, + proc_dointvec_minmax, + SYSCTL_NUMERIC_ZERO), }; static void __init inotify_sysctls_init(void) -- 2.25.1