Re: [PATCH] io_uring: fix xa_alloc_cycle() error return value check

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

 



On Fri, Aug 20, 2021 at 03:01:20PM -0600, Jens Axboe wrote:
>  	ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds,
>  			XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL);
> -	if (!ret)
> -		return id;
> -	put_cred(creds);
> -	return ret;
> +	if (ret < 0) {
> +		put_cred(creds);
> +		return ret;
> +	}
> +	return id;
>  }

Wouldn't you rather:

	if (ret >= 0)
		return id;
	put_cred(creds);
	return ret;

?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux