Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info

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

 



On 06/05, zhongjiang wrote:
>
>  static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>  {
> -	int ret;
> +	int ret, vpid;
>  
>  	if (pid > 0) {
>  		rcu_read_lock();
> @@ -1395,8 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>  
>  	read_lock(&tasklist_lock);
>  	if (pid != -1) {
> +		if (pid == INT_MIN)
> +			vpid = INT_MAX;

Well, this probably needs a comment to explain that this is just "avoid ub".

And if we really want the fix, to me

	if (pid == INT_MIN)
		return -ESRCH;

at the start makes more sense...

Oleg.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[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