Re: [PATCH] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 10 Oct 2019 11:31:17 +0800 Gaowei Pu <pugaowei@xxxxxxxxx> wrote:

> get_unmapped_area already cover the offset_in_page() check and returned
> with error ptr. So replace offset_in_page() with IS_ERR_VALUE().
> 
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2997,7 +2997,7 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla
>  	flags |= VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
>  
>  	error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
> -	if (offset_in_page(error))
> +	if (IS_ERR_VALUE(error))
>  		return error;
>  
>  	error = mlock_future_check(mm, mm->def_flags, len);

./include/linux/err.h:22:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
                                                 ^
./include/linux/compiler.h:78:42: note: in definition of macro unlikely
 # define unlikely(x) __builtin_expect(!!(x), 0)
                                          ^
mm/mmap.c:3006:6: note: in expansion of macro IS_ERR_VALUE
  if (IS_ERR_VALUE(error))





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux