Re: [PATCH v4] mm/ksm: Fix NULL pointer dereference when KSM zero page is enabled
From: Kirill Tkhai
Date: Thu Apr 16 2020 - 07:24:37 EST
On 16.04.2020 09:14, Markus Elfring wrote:
> â
>>> +++ b/mm/ksm.c
>>> @@ -2112,8 +2112,15 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
> â
>>> + if (vma)
>>> + err = try_to_merge_one_page(vma, page,
>>> + ZERO_PAGE(rmap_item->address));
>>> + else
>>> + /**
>>> + * If the vma is out of date, we do not need to
>>> + * continue.
>>> + */
>>> + err = 0;
>>> up_read(&mm->mmap_sem);
> â
>> It's conventional to put braces around multi-line blocks such as this.
>
> Are there different views to consider around the usage of single statements
> together with curly brackets in if branches?
For me Andrew's conversion is the best readable. I try to comment the code
the same way myself. I even thought it's kernel default style :)
Kirill