Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pstore/ram: Move pmsg init earlier

Since the ftrace area can vary in size based on CPU count, move pmsg
initialization earlier so it will have a stable location.

Suggested-by: Paramjit Oberoi <pso@chromium.org>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20221011200112.731334-3-keescook@chromium.org

+5 -5
+5 -5
fs/pstore/ram.c
··· 785 785 if (err) 786 786 goto fail_init; 787 787 788 + err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr, 789 + cxt->pmsg_size, 0); 790 + if (err) 791 + goto fail_init; 792 + 788 793 cxt->max_ftrace_cnt = (cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU) 789 794 ? nr_cpu_ids 790 795 : 1; ··· 798 793 &cxt->max_ftrace_cnt, LINUX_VERSION_CODE, 799 794 (cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU) 800 795 ? PRZ_FLAG_NO_LOCK : 0); 801 - if (err) 802 - goto fail_init; 803 - 804 - err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr, 805 - cxt->pmsg_size, 0); 806 796 if (err) 807 797 goto fail_init; 808 798