[PATCH v2 1/9] pstore: Don't expose ECC metadata via pstore file system

From: Ard Biesheuvel
Date: Tue Jun 21 2022 - 11:36:46 EST


If a pstore record has its ecc_notice_size field set to >0, it means the
record's buffer has that many additional bytes appended to the end that
carry backend specific metadata, typically used for error correction.

Given that this is backend specific, and that user space cannot really
make sense of this metadata anyway, let's not expose it via the pstore
filesystem.

Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
---
fs/pstore/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 14658b009f1b..b62eead3f801 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -349,7 +349,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
int rc = 0;
char name[PSTORE_NAMELEN];
struct pstore_private *private, *pos;
- size_t size = record->size + record->ecc_notice_size;
+ size_t size = record->size;

if (WARN_ON(!inode_is_locked(d_inode(root))))
return -EINVAL;
--
2.35.1