Re: [PATCH] fix: Prevent memory leak by checking for NULL buffer before calling css_put()

From: Markus Elfring
Date: Mon Jun 03 2024 - 09:16:50 EST



> Previously, the code would directly call `css_put()` without checking
> the value of
> `buf`, which could lead to a memory leak if the buffer allocation failed.
> This commit introduces a conditional check to ensure that `css_put()`
> is only called
> if `buf` is not NULL.


How did you come to the conclusion that such a source code adjustment
would trigger a desirable effect?
https://elixir.bootlin.com/linux/v6.10-rc2/source/mm/mmap_lock.c#L188

By the way:
Would you like to reconsider word wrapping for such change descriptions
any more?

Regards,
Markus