diff mbox

arm: mm: idmap: Mark variables as ro_after_init

Message ID 20171208111318.GA12346@pjb1027-Latitude-E5410 (mailing list archive)
State New, archived
Headers show

Commit Message

Jinbum Park Dec. 8, 2017, 11:13 a.m. UTC
idmap_pgd, arch_phys_to_idmap_offset are setup once
while init stage, and never changed after that.
so, it is good candidate for __ro_after_init.

Signed-off-by: Jinbum Park <jinb.park7@gmail.com>
---
 arch/arm/mm/idmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kees Cook Dec. 8, 2017, 8:59 p.m. UTC | #1
On Fri, Dec 8, 2017 at 3:13 AM, Jinbum Park <jinb.park7@gmail.com> wrote:
> idmap_pgd, arch_phys_to_idmap_offset are setup once
> while init stage, and never changed after that.
> so, it is good candidate for __ro_after_init.
>
> Signed-off-by: Jinbum Park <jinb.park7@gmail.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

Does arm64 have anything like this? Just grepping for similar names,
idmap_t0sz looks like it could actually be const.

-Kees

> ---
>  arch/arm/mm/idmap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
> index 10bfba8..1d1edd0 100644
> --- a/arch/arm/mm/idmap.c
> +++ b/arch/arm/mm/idmap.c
> @@ -16,8 +16,8 @@
>   * are not supported on any CPU using the idmap tables as its current
>   * page tables.
>   */
> -pgd_t *idmap_pgd;
> -long long arch_phys_to_idmap_offset;
> +pgd_t *idmap_pgd __ro_after_init;
> +long long arch_phys_to_idmap_offset __ro_after_init;
>
>  #ifdef CONFIG_ARM_LPAE
>  static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 10bfba8..1d1edd0 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -16,8 +16,8 @@ 
  * are not supported on any CPU using the idmap tables as its current
  * page tables.
  */
-pgd_t *idmap_pgd;
-long long arch_phys_to_idmap_offset;
+pgd_t *idmap_pgd __ro_after_init;
+long long arch_phys_to_idmap_offset __ro_after_init;
 
 #ifdef CONFIG_ARM_LPAE
 static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,