summaryrefslogtreecommitdiff
path: root/fs/pstore
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/ram_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 0306303be372..e5afa222c213 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -187,7 +187,8 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz,
prz->ecc_block_size = 128;
prz->ecc_size = ecc_size;
- ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size);
+ ecc_blocks = DIV_ROUND_UP(prz->buffer_size - prz->ecc_size,
+ prz->ecc_block_size + prz->ecc_size);
ecc_total = (ecc_blocks + 1) * prz->ecc_size;
if (ecc_total >= prz->buffer_size) {
pr_err("%s: invalid ecc_size %u (total %zu, buffer size %zu)\n",