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-next>] [day] [month] [year] [list]
Message-Id: <20191022174108.15554-1-andrealmeid@collabora.com>
Date:   Tue, 22 Oct 2019 14:41:08 -0300
From:   André Almeida <andrealmeid@...labora.com>
To:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     axboe@...nel.dk, kernel@...labora.com, krisman@...labora.com,
        André Almeida <andrealmeid@...labora.com>
Subject: [PATCH] blk-mq: remove needless goto from blk_mq_get_driver_tag

The only usage of the label "done" is when (rq->tag != -1) at the
begging of the function. Rather than jumping to label, we can just
remove this label and execute the code at the "if". Besides that,
the code that would be executed after the label "done" is the return of
the logical expression (rq->tag != -1) but since we are already inside
the if, we now that this is true. Remove the label and replace the goto
with the proper result of the label.

Signed-off-by: André Almeida <andrealmeid@...labora.com>
---
Hello,

I've used `blktest` to check if this change add any regression. I have
used `./check block` and I got the same results with and without this
patch (a bunch of "passed" and three "not run" because of the virtual
scsi capabilities). Please let me know if there would be a better way to
test changes at block stack.

This commit was rebase at linux-block/for-5.5/block.

Thanks,
	André
---
 block/blk-mq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8538dc415499..1e067b78ab97 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1036,7 +1036,7 @@ bool blk_mq_get_driver_tag(struct request *rq)
 	bool shared;
 
 	if (rq->tag != -1)
-		goto done;
+		return true;
 
 	if (blk_mq_tag_is_reserved(data.hctx->sched_tags, rq->internal_tag))
 		data.flags |= BLK_MQ_REQ_RESERVED;
@@ -1051,7 +1051,6 @@ bool blk_mq_get_driver_tag(struct request *rq)
 		data.hctx->tags->rqs[rq->tag] = rq;
 	}
 
-done:
 	return rq->tag != -1;
 }
 
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ