Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp253243rdb; Sat, 30 Sep 2023 03:16:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFePWmSKaxqqd82TTSTcf+QHSprQ0RJgJEg9aW4xYINc175I4kqzqBjKVglQZprurjGjxLQ X-Received: by 2002:a05:6a00:2482:b0:68f:caaa:e6d5 with SMTP id c2-20020a056a00248200b0068fcaaae6d5mr7428568pfv.14.1696069012356; Sat, 30 Sep 2023 03:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696069012; cv=none; d=google.com; s=arc-20160816; b=xyv3yvTM89mMsQJzAajgfBodraGbjIB0AnctMXEnSNDvgbYQvBZvmrktzz147ehN+F 2rIIhKntn8Be0qEvu/5qYGkRBY0Asrf7a/+u3228ZgxpSghFLO7h24enPDKSdtxq8t7A ybXvuF2BFkAfgPxZm/QN/hx2WDigWbP+02Dyg8SPg6v02nMcrbDEdY57+b+ohA6y49jf yYiWDxACsztbIdiXdZg1fc8gl/xBPPxId56JOfsnb+Rd8nOdFehmdHgSZnXmgaWlwnR5 Bt05BNO0vVli76H9i9oURj21MCOLNUEHw8bN9RdRLKWx5U53f1wmJNUTWph9AheDuCq9 F9Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; fh=pZg0L/n76CzeI+Iax/GwQBT1mLSudd1jhViRHLd4PC0=; b=tQw1AQ8msPGbHNJQE2wGSzH/iz82JL0A7jqK8IDy69FSu9ZK868OP6ybkyvjBUr2pW K/lerMlTy/21G+b3pymbJ+Od3gaPJ+yKMP1ayH3UZRJ/Td0PbfisiLZZ85WIvVLGX3e0 vQSSgDT+j/x0GdLBACh4GKPjMS9290yJOoX19vohhYSNxvgE2xhG7hDWHbVGHbQVLjMe Di+l/0Rv2qmlOk9pj4OkEY45BbRmTjXDULlUOhkJ5ZH4YM4oS6Ez2YHFYrqvUEx4PfVz lKkghF/r9rkDydKXJGmjta59R8UzDsY8vJZ8HUafm9Bpx6r1gxRkGDYhfDbZLTokr6jn g2Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m9y5oWQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j72-20020a638b4b000000b00577f7bc56absi23835343pge.100.2023.09.30.03.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 03:16:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m9y5oWQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 18B9B8025BC0; Fri, 29 Sep 2023 22:03:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234205AbjI3FDl (ORCPT + 99 others); Sat, 30 Sep 2023 01:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbjI3FDB (ORCPT ); Sat, 30 Sep 2023 01:03:01 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E860F19A7; Fri, 29 Sep 2023 22:02:06 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c735473d1aso24030585ad.1; Fri, 29 Sep 2023 22:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050126; x=1696654926; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; b=m9y5oWQza7nh/yZ20urfhCbcy1kUZ2krNB39UVylJBvU8G/oKiNgOmyUL5Ziokcr/J c/hKbNws8ir2Ar61HSJwid9KLdc0oM4Xoy0fYi7WWC4oFGZOsKKFv4CqdgoGzju+cb4P lgpmLKMFSoJ03dQm/fBz1DMi/4b5URf+aQQSxCoJ41gnnNXKVEp3ktLjI6Qxk6qMH5ZE orcMqhH/wqWedFDlJnOOTcXl9rF3HQvQGuE17hlv+2WVKbiGEBMctHZ/qHZMD2X1OgnM a5RbzawyR3JVyFLJaZxlNftYzSdZeAohsJn7kUYYd2pe7kwYrFHLGuK6aV1wvcnq6YAh hjzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050126; x=1696654926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; b=K9PpvlduTpOqJ9OGt0CXWg6E0DKKZ4gEFfMt95DgqnhlTkxrw8k82ghYvnTNJwTEJ2 TPu6YDRfVmGvOzkRujSD1y5NU+U1iptuRi0wN2RrCmhEdXEOlLQxt+eBjfu8eZBpQv69 PVoNrVWRhD6ceimLf/mI4nXa17U7oKPp3NEl+ufpFGHFgp1qqWJO2LDla6QKKGLl9ws1 iTsXB9Yks/FoKLFSDuaM7dVKPzBtz8eQz1j0daOepNnT0bp5KOESjV//P2AzsNHIW0Jw YMhPXrh7hY+V0pYWxlQ9DTb4BY1JxS/qqto9grrKDbjBauSfkUknM13CPg6NzgLItnPQ SQyw== X-Gm-Message-State: AOJu0YxzpPOxm/p0D8O3BgCo9kGBNDn9tX7B8EoMJxUroY/8TpbmEe0Q +JPR/4KBLPkMKpCD+R4Oq18= X-Received: by 2002:a17:902:f7c6:b0:1c3:a4f2:7c92 with SMTP id h6-20020a170902f7c600b001c3a4f27c92mr4959184plw.65.1696050125757; Fri, 29 Sep 2023 22:02:05 -0700 (PDT) Received: from wedsonaf-dev.home.lan ([189.124.190.154]) by smtp.googlemail.com with ESMTPSA id y10-20020a17090322ca00b001c322a41188sm392136plg.117.2023.09.29.22.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:05 -0700 (PDT) From: Wedson Almeida Filho To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wedson Almeida Filho , Mark Fasheh , Joel Becker , Joseph Qi , ocfs2-devel@lists.linux.dev Subject: [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata Date: Sat, 30 Sep 2023 02:00:24 -0300 Message-Id: <20230930050033.41174-21-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230930050033.41174-1-wedsonaf@gmail.com> References: <20230930050033.41174-1-wedsonaf@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:55 -0700 (PDT) From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ocfs2_xattr_handlers or ocfs2_xattr_handler_map at runtime. Cc: Mark Fasheh Cc: Joel Becker Cc: Joseph Qi Cc: ocfs2-devel@lists.linux.dev Signed-off-by: Wedson Almeida Filho --- fs/ocfs2/xattr.c | 4 ++-- fs/ocfs2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4ac77ff6e676..1c54adac1e50 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -87,14 +87,14 @@ static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count = cpu_to_le16(1), }; -const struct xattr_handler *ocfs2_xattr_handlers[] = { +const struct xattr_handler * const ocfs2_xattr_handlers[] = { &ocfs2_xattr_user_handler, &ocfs2_xattr_trusted_handler, &ocfs2_xattr_security_handler, NULL }; -static const struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { +static const struct xattr_handler * const ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] = &nop_posix_acl_default, diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h index 00308b57f64f..65e9aa743919 100644 --- a/fs/ocfs2/xattr.h +++ b/fs/ocfs2/xattr.h @@ -30,7 +30,7 @@ struct ocfs2_security_xattr_info { extern const struct xattr_handler ocfs2_xattr_user_handler; extern const struct xattr_handler ocfs2_xattr_trusted_handler; extern const struct xattr_handler ocfs2_xattr_security_handler; -extern const struct xattr_handler *ocfs2_xattr_handlers[]; +extern const struct xattr_handler * const ocfs2_xattr_handlers[]; ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, -- 2.34.1