Re: [PATCH] pstore: Refactor compression initialization

From: Kees Cook
Date: Thu Oct 18 2018 - 14:01:46 EST


On Thu, Oct 18, 2018 at 10:14 AM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> On Wed, 2018-10-17 at 14:41 -0700, Kees Cook wrote:
>> With compression initialization now separated from pstore_register(),
>> there is no longer a good reason to do compression method selection
>> during fs init. Instead, merge everything together into the late init.
>> Additionally cleans up the reporting to be more clear.
> []
>> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> []
>> @@ -274,36 +274,56 @@ static int pstore_decompress(void *in, void *out,
> []
>> - big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
>> - if (!big_oops_buf) {
>> - pr_err("allocate compression buffer error!\n");
>> + buf = kmalloc(size, GFP_KERNEL);
>> + if (!buf) {
>> + pr_err("Failed %d byte compression buffer allocation for: %s\n",
>> + size, zbackend->name);
>
> Given that there is a generic OOM message emitted on
> kmalloc failures, rather than expanding the unnecessary
> alloc failure message, how about just deleting it instead?

I prefer including more context (i.e. the desired compression method).

-Kees

--
Kees Cook
Pixel Security