Skip to contentSkip to conversation

pstore: remove superfluous memory size check

PATCH In review Mark Salyzyn 2 participants 2 messages Jan 6, 2015 – Jan 13, 2015 Pstore filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 pstore: remove superfluous memory size check

All previous checks will fail with error if memory size is not sufficient to register a zone, so this legacy check has become redundant.

---
 fs/pstore/ram.c | 9 ---------
 1 file changed, 9 deletions(-)
fs/pstore/ram.c +0 -9
index 8613e5b..34ed8f8 100644
@@ -474,14 +474,6 @@ static int ramoops_probe(struct platform_device *pdev)
 	if (err)
 		goto fail_init_fprz;
 
-	if (!cxt->przs && !cxt->cprz && !cxt->fprz) {
-		pr_err("memory size too small, minimum is %zu\n",
-			cxt->console_size + cxt->record_size +
-			cxt->ftrace_size);
-		err = -EINVAL;
-		goto fail_cnt;
-	}
-
 	cxt->pstore.data = cxt;
 	/*
 	 * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we
@@ -525,7 +517,6 @@ fail_buf:
 	kfree(cxt->pstore.buf);
 fail_clear:
 	cxt->pstore.bufsize = 0;
-fail_cnt:
 	kfree(cxt->fprz);
 fail_init_fprz:
 	kfree(cxt->cprz);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Acked-by on v1 2/3
#1 lore raw
Quoted 15 lines · Mark Salyzyn

All previous checks will fail with error if memory size is not sufficient to register a zone, so this legacy check has become redundant.

---
 fs/pstore/ram.c | 9 ---------
 1 file changed, 9 deletions(-)
fs/pstore/ram.c +0 -0
index 8613e5b..34ed8f8 100644
@@ -474,14 +474,6 @@ static int ramoops_probe(struct platform_device *pdev)
        if (err)

fs/pstore/ram.c static int ramoops_probe(struct platform_device *pdev) · line 484

Quoted 10 lines
fs/pstore/ram.c +0 -8
                goto fail_init_fprz;
 
-       if (!cxt->przs && !cxt->cprz && !cxt->fprz) {
-               pr_err("memory size too small, minimum is %zu\n",
-                       cxt->console_size + cxt->record_size +
-                       cxt->ftrace_size);
-               err = -EINVAL;
-               goto fail_cnt;
-       }
-

Yup, good call. ramoops_init_przs and ramoops_init_prz do all the checks already.

-Kees

Quoted 14 lines
fs/pstore/ram.c +0 -2
        cxt->pstore.data = cxt;
        /*
         * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we
@@ -525,7 +517,6 @@ fail_buf:
        kfree(cxt->pstore.buf);
 fail_clear:
        cxt->pstore.bufsize = 0;
-fail_cnt:
        kfree(cxt->fprz);
 fail_init_fprz:
        kfree(cxt->cprz);
--

2.2.0.rc0.207.ga3a616c

Signature · 2 lines
Kees Cook
Chrome OS Security