From patchwork Sat Sep 30 05:00:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wedson Almeida Filho X-Patchwork-Id: 146880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp204632vqb; Fri, 29 Sep 2023 22:17:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsZumEeCNg7n079AUZfQwtlSqvf5zj8B4woZ9yEIuf7X2HiJomebd/kQOQjryHBtVOhM2Y X-Received: by 2002:a05:6a20:12d1:b0:15e:7323:5bf3 with SMTP id v17-20020a056a2012d100b0015e73235bf3mr9791968pzg.26.1696051033494; Fri, 29 Sep 2023 22:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696051033; cv=none; d=google.com; s=arc-20160816; b=KpXtnJPHRJoIM1qknPtYHCyBIAC5pr4VM+Ac1t8pkNQwEceKwZIa16PL3aMQVKu5Bd DV3Y9rvx5rTd+fgeFlR2k1t4WCaijhN/SvRsxikVJN5lW3Qrl6wAq2EqfGG9Hn8nLnQE 1llh+BmOBkmlvX3DozaREVTcx3+Pb/jwZFTVjFk30ZtwPVQdKm53Ztoa3lSyDpQv3xZ6 J2bPx/jOROnvcCYTPyoLUbdtdtxB9K8ZRej7dA4FEkyYDJXKe1diL03PwP85zf5Tzc1H Khclgfj+nUvg+Dc/x+tFLimTEoaxFm7x3/VlWdiY/MuIEblOqnEFbCuolZ+uph/Y7jnu aHRQ== 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; fh=2hKbA38J/0D7ONeud+Nfm7+vtN0CZnGnMYAncAgVqYw=; b=XB1d7fRI2hbECnJSn+G68aqWr0sDbgpHkXjocVdkofz/zlr7LHEet2KVcIaSCzeN8N VtD3p0E4NjN07q6iCDP7i+epzjgw/uL6BdoZVp4srFEZZ0tCr71A4U04LGoDYpKHFpZF kmVcZKgz7o/Vc5UH5U+sbIQQJaaIWq3+PJXgsSNn0nJItJ4HMm7xfcBg6hF+7ygtcfEL gIreRvKQkHS/quBYiWtQEmHw2Eq3BbJlSMGFC6YyNxKLECUudoC3tQBjFVdceGoPG3vu tXDr1wtPtAFkbaHET0x+NIm6cIerHJWW9oBizqs+z69GGIc/dBU4V3CJczpKVt4wbJ+4 HfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Lk93wttL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x190-20020a6386c7000000b005859c29ce86si3383904pgd.84.2023.09.29.22.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Lk93wttL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 449BF826EB87; Fri, 29 Sep 2023 22:03:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234199AbjI3FDB (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234072AbjI3FCH (ORCPT ); Sat, 30 Sep 2023 01:02:07 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2EC10C1; Fri, 29 Sep 2023 22:01:46 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c63164a2b6so9927795ad.0; Fri, 29 Sep 2023 22:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050106; x=1696654906; 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; b=Lk93wttLTNuHCCDZqSRZu5hJ6zh3eTJKxYMAetLyk/k1h/oXdJnm0fCj38edehQLsl XoA4+r8hWx+EEbFhBJkkysH94rH1vypgXKJ3g/jBhyU1TDyJLkDJuMFzLFakzLrWyLmC o26/AiZu2yqdMpvtI8+46US7syVhfZpxaf1Mv79qGeOxrF5g69Vc+r4Vbw9FVnLFqZFl Nt32QadODTj6Ur0bNdbLd/h7b56+rv7bHRGV+hl7cA1uCU/mtoKtKYnALbPoaWPmn3kI MmYUZKyU9h4verzDki9ZCfxMtcSPqTNc36UUCXQ1ldMjqf4ilfgAOpbdKm4knONhASF1 4rmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050106; x=1696654906; 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; b=dACHRVqLaENYRh8Z6MnZ9JICvB/ru8u9Xce4ISCIHoH+1Yb5nLf+ijkz51UQuZkkf4 rXvvIR9IixVQ3pYAvdrdraG5uPm5FHxib84mQzlJ+o4kDhBNWvEl1uLDeqJGr+vPN3dv ItFBUPbP2oXNbSmgqV3s4GgliILi0Ue+HqJN/Vmf8iP2VoVh3lMSw4CR7bsEEFvSFlis GFdop2QncRDYusWoaybkRZDRwqc8R6FIKcAZFgtNGL3AbA3psl/a811hUWrIXXjeJcPN X1syXbzstlrafr5Q5Ad4ya6cV6htyFE1ZHJDkPrP0s6zI9F8anRODh71UbBRwe8gWLmu 9xUg== X-Gm-Message-State: AOJu0Yx0m+wAEfLuCHMK1sGD1AjPhVcU82WKyzH6AIDrWI2S4BE6ceZU qB4/JkkTv2zqv2CtF9fYvqM= X-Received: by 2002:a17:903:41d1:b0:1c3:432f:9f69 with SMTP id u17-20020a17090341d100b001c3432f9f69mr11026355ple.23.1696050105710; Fri, 29 Sep 2023 22:01:45 -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.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:45 -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 , David Woodhouse , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:19 -0300 Message-Id: <20230930050033.41174-16-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 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778438408329610107 X-GMAIL-MSGID: 1778438408329610107 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to jffs2_xattr_handlers at runtime. Cc: David Woodhouse Cc: Richard Weinberger Cc: linux-mtd@lists.infradead.org Signed-off-by: Wedson Almeida Filho --- fs/jffs2/xattr.c | 2 +- fs/jffs2/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 3b6bdc9a49e1..00224f3a8d6e 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c @@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) * is an implementation of setxattr handler on jffs2. * -------------------------------------------------- */ -const struct xattr_handler *jffs2_xattr_handlers[] = { +const struct xattr_handler * const jffs2_xattr_handlers[] = { &jffs2_user_xattr_handler, #ifdef CONFIG_JFFS2_FS_SECURITY &jffs2_security_xattr_handler, diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h index 1b5030a3349d..7e7de093ec0a 100644 --- a/fs/jffs2/xattr.h +++ b/fs/jffs2/xattr.h @@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, const char *buffer, size_t size, int flags); -extern const struct xattr_handler *jffs2_xattr_handlers[]; +extern const struct xattr_handler * const jffs2_xattr_handlers[]; extern const struct xattr_handler jffs2_user_xattr_handler; extern const struct xattr_handler jffs2_trusted_xattr_handler;