Re: [PATCH] mm:bugfix check return value of ioremap_prot

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

 



On Thu, Aug 2, 2018 at 12:37 AM,  <chenjie6@xxxxxxxxxx> wrote:
> From: chen jie <chen jie@chenjie6@xxxxxxxxx>
>
>         ioremap_prot can return NULL which could lead to an oops

What oops? You'd better to have the oops information in your commit log.

Thanks,
Yang

>
> Signed-off-by: chen jie <chenjie6@xxxxxxxxxx>
> ---
>  mm/memory.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 7206a63..316c42e 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4397,6 +4397,9 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
>                 return -EINVAL;
>
>         maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
> +       if (!maddr)
> +               return -ENOMEM;
> +
>         if (write)
>                 memcpy_toio(maddr + offset, buf, len);
>         else
> --
> 1.8.3.4
>




[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