Received: by 2002:ab2:5d18:0:b0:1ef:7a0f:c32d with SMTP id j24csp105624lqk; Sat, 9 Mar 2024 02:34:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUBF3IdAEtHDgq/SNGow2huXSbESwMTY9Bl6slzHd32jReGKW6n9KW+QtEu9I7drgCP6EbNfLKjTVyHgnJ/UpOAMOIkO3Ibw2m5jpcAvw== X-Google-Smtp-Source: AGHT+IG2hreLZBD/5gutoV+rU65GfPl2nIlZM4Aii0AAFCJFD6TQJG4P3dO99ariSMbhCtYm+1G/ X-Received: by 2002:a05:6a21:788f:b0:1a1:3ecb:5316 with SMTP id bf15-20020a056a21788f00b001a13ecb5316mr1637263pzc.0.1709980452658; Sat, 09 Mar 2024 02:34:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709980452; cv=pass; d=google.com; s=arc-20160816; b=iAqw2In1B2I254se/Gb+XrpN6mrKN6kCXmdx+D6iUcr22bFdFzWfW7V0FLHv7DgrOT pAIR2NuLO4BWlKZTRjrA3deQDOQOKVek3tfkgeVMCXi21eHRI2vUfbuB16gq/QmyL9l1 QY8iX9Hs9YR9L7Hq5ChomQb/v96gly9HffAor3qS1Aw6KwWjJibz2Pt60mjGNoliuxX3 ECL1mweR/GwTTwoHwR/HrBtsf0OHi1Yzr9tlGGTyB0aLsgAbBphpg5GCdhM2ffZ4Ddno x25Wcwc0IzAG1Q4Dqi4g5g9c+qT20Hmc1fT+VkbwrslBP3/hvHBf532hCA/AqivENYDR v8xQ== 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=2H1b9z/Ch+YbayzL6HXIjXaU8eTko6BHnf/uvHQTEwU=; b=Yfd1YDIv8xTFwFh3Oa3xloEgcyZ/R+Ppy5QVtet2O80pWrZ9cm0w1mkKpSJTOqa70r nkmnqXny4+kaZa0LarVRLj42ENwD2umI5ynj/+z6VLW5Fl9pc9Yp8VmFrtDjM0Z92X3l u4ZiYtqHlN73yr1DZryDwI9cfpYvu7Rfag87n0tXde5sCrBRfc+E7KoMLn29goOutn+v NsBbTjuzgcRXqf++tMRdHyKTs8sbAncQ6HliRQKtocyFTExDZGUBW0gUbdbYGMlIaJGO +vzlNgwitGkz3/SOlfjdmgk2abBkaAHOah/O9RZW4TJofxRG5pSvRdQlb/e1SG3BXfzK Oh7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=EsTq3fiY; 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-97853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97853-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. [147.75.48.161]) by mx.google.com with ESMTPS id l8-20020a633e08000000b005dc42fd8c40si1248921pga.404.2024.03.09.02.34.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 02:34:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97853-linux.lists.archive=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=EsTq3fiY; 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-97853-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97853-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 21106B21194 for ; Sat, 9 Mar 2024 10:34:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA2FF383A3; Sat, 9 Mar 2024 10:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=foxmail.com header.i=@foxmail.com header.b="EsTq3fiY" Received: from out203-205-251-59.mail.qq.com (out203-205-251-59.mail.qq.com [203.205.251.59]) (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 0968138F97 for ; Sat, 9 Mar 2024 10:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.251.59 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709980368; cv=none; b=kUbpKqIqRQQjj7/RSe7vuGijtc+VOqAclWXuj8uBXMxfpQy6CY1+SJfCjq0bXndC4hEf4tlEEwNxbajZ2CpXl3ykcFw/dtkTdk9yDpf2ixi+hvEwH5fq5iWk2RBOw7iKT+VEjNwi6fVVcK0oQs9M46NSoOEl47VdRRFrFsUeReE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709980368; c=relaxed/simple; bh=NJKqmOHNR07G45d4NVjLLw9EdzmYl7F7Ce1i+WlWE7s=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=TtWgC7K2b0ZnhK9WseLZpYZKmMXRmUuykewnRmRpAYGLh5GO51idVO+r6tHF0/7terkijrK/UUnLojVVGcM7weWhlJDsI++32CpjgHk7pxkEWX8HniyLaY4o2znfheWaBMb7H5dB8dq2EubZWpwoLm1BbMP4wBb2X1ocpLHLJVc= 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=EsTq3fiY; arc=none smtp.client-ip=203.205.251.59 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=1709980358; bh=SSRgMEacKlRgTzt0buSQ6sVgqkbUDUraShL6rUZA97w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EsTq3fiYUUdB3E6GBmvLkkX06DKgHdkDfm9UHKdXotIYPg0JHDHYWqZGQUh7SAJh4 cYPNacjSTC1Yu5TpO+JJBE5RjbfeQ3exOb/DjcmFhOvFEKFCHjq2dGej1rg3rexBzr 0WCCaCFe9LxNHmELdI0/ndKKnCI/xsgas+uWEzE0= Received: from localhost.localdomain ([2409:8961:2a0b:4ad8:c972:9bc3:984f:98a9]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id 7EF8DC9A; Sat, 09 Mar 2024 18:31:47 +0800 X-QQ-mid: xmsmtpt1709980334t1sqlvol2 Message-ID: X-QQ-XMAILINFO: MB5+LsFw85No5ibEFZnXtcXauqggPA/99tpCySGtWw0DWp2iq6fMwdi+qOmNZ0 peu5GmZWfSllRYVpW8LkBdNJh2Q4XGO7wmOdECpCjpCm9XR+n+0YmiokJlRGs9x6zZRFw8lPt9oF m9VOdyap7zti44H3JfYpXrfyWeKD4lFT7Iy7i+Q+/wZ1stoDpwWEzMI6wuGmFZYh/6jet6Q6twVi ZwO/BW0fch4c1z3Ldb2/g053+tfNWYh+Qzqz/BPPGugH+vE45qRHwzU64AtHNdSiNVarbQxOWtKi srSFD4Z+GSi0ecZG5fTgjafCbWND0cnoqVM/Q42IOhSYBX6K+VH+uLOn44y4p/8s/pT0Gbj33PZw oZIGabI7uL45sknYbKTmauFBGz7IN443knkQr5VuXTHcDYLpkUhDQn77d7SwCnxtnCmlASqE/Ap6 DSP8lzAIh1Tsj2SCchJ9cmTecnJJDTe9CYKnDYsPkk4WVs7t/3RbNNkRkZkSazZVY3bKa6A1Gp6V H793wGhGJz78Mnjik08IaQUYAMR4u/Y62+BiiL6ROEMqnUaCFc840kmwlh6phVpDfBupGZXNwJwn FQQdH551Va+To7x8uBstP1jtEeiVskjoVxWMS6BhMpb6rjPCuDe1OassjiQcoAU9Tt84eQtykybc mcy2VnYfV8OnMGEcco731zmR5x2O4g8PkLO+xE2V+wP6I8EMgTi6sdSHO7XJvCvQhykjeWWC9RH0 Eko7FXZRwB4V0y2P6dHqtSxdJRt6t1SjmskiSFq+l3hgpZAqndUeC5T2wYyyk3rjULkO3zdVzscC RlRtq36QHVWlaU4QH54tWoxhXcOSX0TKjfPktDHsqHzOU1qFyZ787FBmYkRkezv87hCx99TVbme1 rZiZ8fjUTzOZvOER2cFZjfMuY9TQ1KIm/+ES3NK+FGg06qoB+XtBehiQEQ06v+z7WhEzqBPwCMUf HHdpGwtBX7c5Kr6y5R65OvZ4ZHSoFI2wkQAJ3zuIgaU5X9FMrEeEdPIqVQr+kUDTSHjdgnxL5pjH FGcZN3vRHFUG5b26ttb6TkbPLh/GGAH1qsL6/yHEC/ScZW/apv2Sy4li9UsFzCzxbHXB2ZTw== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= From: wenyang.linux@foxmail.com To: "Eric W . Biederman" , Luis Chamberlain , Kees Cook , Joel Granados , Christian Brauner Cc: Wen Yang , Jan Kara , "Darrick J. Wong" , linux-kernel@vger.kernel.org Subject: [PATCH v2 8/9] fs: inotify: delete these unnecessary static variables it_zero and it_int_max Date: Sat, 9 Mar 2024 18:31:25 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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