Re: [PATCH] kprobes: Remove an unneeded condition

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

 



On Tue, 21 Mar 2017 23:43:48 +0300
Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> We know that "addr" is non-NULL here so there is no need to check if
> "addr + offset" is NULL.

What about "UINT_MAX - addr + 1 == offset" case on 32bit arch ? :)

Thanks,

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index d733479a10ee..88617178a63e 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1403,9 +1403,7 @@ static kprobe_opcode_t *_kprobe_addr(kprobe_opcode_t *addr,
>  			return ERR_PTR(-ENOENT);
>  	}
>  
> -	addr = (kprobe_opcode_t *)(((char *)addr) + offset);
> -	if (addr)
> -		return addr;
> +	return (kprobe_opcode_t *)(((char *)addr) + offset);
>  
>  invalid:
>  	return ERR_PTR(-EINVAL);


-- 
Masami Hiramatsu <mhiramat@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux