• Peng Wang's avatar
    pstore: Avoid duplicate call of persistent_ram_zap() · 7684bd33
    Peng Wang authored
    When initialing a prz, if invalid data is found (no PERSISTENT_RAM_SIG),
    the function call path looks like this:
    
    ramoops_init_prz ->
        persistent_ram_new -> persistent_ram_post_init -> persistent_ram_zap
        persistent_ram_zap
    
    As we can see, persistent_ram_zap() is called twice.
    We can avoid this by adding an option to persistent_ram_new(), and
    only call persistent_ram_zap() when it is needed.
    Signed-off-by: default avatarPeng Wang <wangpeng15@xiaomi.com>
    [kees: minor tweak to exit path and commit log]
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    7684bd33
ram_core.c 14.4 KB