lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1548977479.213038.20.camel@acm.org>
Date:   Thu, 31 Jan 2019 15:31:19 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Evan Green <evgreen@...omium.org>, Jens Axboe <axboe@...nel.dk>
Cc:     Gwendal Grignou <gwendal@...omium.org>,
        Martin K Peterson <martin.peterson@...cle.com>,
        Alexis Savery <asavery@...omium.org>,
        Ming Lei <ming.lei@...hat.com>, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH 1/2] loop: Report EOPNOTSUPP properly

On Thu, 2019-01-31 at 14:13 -0800, Evan Green wrote:
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index cf5538942834..a1ba555e3b92 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -458,8 +458,13 @@ static void lo_complete_rq(struct request *rq)
>  
>  	if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
>  	    req_op(rq) != REQ_OP_READ) {
> -		if (cmd->ret < 0)
> -			ret = BLK_STS_IOERR;
> +		if (cmd->ret < 0) {
> +			if (cmd->ret == -EOPNOTSUPP)
> +				ret = BLK_STS_NOTSUPP;
> +			else
> +				ret = BLK_STS_IOERR;
> +		}

Please do not nest if-conditions if that is not necessary. I think the
above code can be written more clearly as follows:

if (cmd->ret == -ENOTSUPP)
	ret = BLK_STS_NOTSUPP;
else if (cmd->ret < 0)
	ret = BLK_STS_IOERR;

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ