Re: support pmsg record size larger than kmalloc limitation

From: Greg KH
Date: Tue Jun 27 2023 - 13:35:49 EST


On Tue, Jun 27, 2023 at 10:05:04AM -0700, Yuxiao Zhang wrote:
> kfree(record->priv);
> kfree(record);
> if (rc != -EEXIST || !quiet)
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index ade66dbe5f39..296465b14fa9 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -20,6 +20,7 @@
> #include <linux/compiler.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> +#include <linux/mm.h>
>
> #include "internal.h"
> #include "ram_internal.h"
> @@ -268,7 +269,7 @@ static ssize_t ramoops_pstore_read(struct
> pstore_record *record)
> /* ECC correction notice */
> record->ecc_notice_size = persistent_ram_ecc_string(prz, NULL, 0);
>
> - record->buf = kmalloc(size + record->ecc_notice_size + 1, GFP_KERNEL);
> + record->buf = kvmalloc(size + record->ecc_notice_size + 1, GFP_KERNEL);
> if (record->buf == NULL) {
> size = -ENOMEM;
> goto out;

Please try emailing a patch to yourself and see if you can apply it
afterwards. The kernel documentation has a section for how to handle
email clients, perhaps you should read it?

thanks,

greg k-h