Re: [PATCH v3 13/23] mm/mmap: Make vm_special_mapping::mremap return void

From: Dmitry Safonov
Date: Mon Jun 21 2021 - 17:12:51 EST


On 6/17/21 8:20 AM, Christophe Leroy wrote:
>
>
> Le 11/06/2021 à 20:02, Dmitry Safonov a écrit :
>> Previously .mremap() callback had to return (int) to provide
>> a way to restrict resizing of a special mapping. Now it's
>> restricted by providing .may_split = special_mapping_split.
>>
>> Removing (int) return simplifies further changes to
>> special_mapping_mremap() as it won't need save ret code from the
>> callback. Also, it removes needless `return 0` from callbacks.
>>
>> Signed-off-by: Dmitry Safonov <dima@xxxxxxxxxx>
>> ---
>>   arch/arm/kernel/process.c | 3 +--
>>   arch/arm64/kernel/vdso.c  | 4 +---
>>   arch/mips/vdso/genvdso.c  | 3 +--
>>   arch/x86/entry/vdso/vma.c | 4 +---
>>   include/linux/mm_types.h  | 4 ++--
>>   mm/mmap.c                 | 2 +-
>>   6 files changed, 7 insertions(+), 13 deletions(-)
>>
>
> Build failure:
>
>   CC      arch/powerpc/kernel/vdso.o
> arch/powerpc/kernel/vdso.c:93:19: error: initialization of 'void
> (*)(const struct vm_special_mapping *, struct vm_area_struct *)' from
> incompatible pointer type 'int (*)(const struct vm_special_mapping *,
> struct vm_area_struct *)' [-Werror=incompatible-pointer-types]
>    93 |         .mremap = vdso32_mremap,
>       |                   ^~~~~~~~~~~~~
> arch/powerpc/kernel/vdso.c:93:19: note: (near initialization for
> 'vdso32_spec.mremap')
> arch/powerpc/kernel/vdso.c:98:19: error: initialization of 'void
> (*)(const struct vm_special_mapping *, struct vm_area_struct *)' from
> incompatible pointer type 'int (*)(const struct vm_special_mapping *,
> struct vm_area_struct *)' [-Werror=incompatible-pointer-types]
>    98 |         .mremap = vdso64_mremap,
>       |                   ^~~~~~~~~~~~~
> arch/powerpc/kernel/vdso.c:98:19: note: (near initialization for
> 'vdso64_spec.mremap')
> cc1: all warnings being treated as errors
> make[3]: *** [arch/powerpc/kernel/vdso.o] Error 1
> make[2]: *** [arch/powerpc/kernel] Error 2
> make[1]: *** [arch/powerpc] Error 2
> make: *** [__sub-make] Error 2
>

Thanks for reporting, Christophe, I'll fix that in v4.

Thanks,
Dmitry