Commit 34f0ec82 authored by Liu ShuoX's avatar Liu ShuoX Committed by Tony Luck

pstore: Correct the max_dump_cnt clearing of ramoops

In case that ramoops_init_przs failed, max_dump_cnt won't be reset to
zero in error handle path.
Signed-off-by: default avatarLiu ShuoX <shuox.liu@intel.com>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent b0aa931f
......@@ -320,6 +320,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
{
int i;
cxt->max_dump_cnt = 0;
if (!cxt->przs)
return;
......@@ -350,7 +351,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
GFP_KERNEL);
if (!cxt->przs) {
dev_err(dev, "failed to initialize a prz array for dumps\n");
return -ENOMEM;
goto fail_prz;
}
for (i = 0; i < cxt->max_dump_cnt; i++) {
......@@ -508,7 +509,6 @@ static int ramoops_probe(struct platform_device *pdev)
kfree(cxt->pstore.buf);
fail_clear:
cxt->pstore.bufsize = 0;
cxt->max_dump_cnt = 0;
fail_cnt:
kfree(cxt->fprz);
fail_init_fprz:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment