All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zbd: relocate Coverity annotation
@ 2021-01-30  3:35 Dmitry Fomichev
  2021-01-30  5:07 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Fomichev @ 2021-01-30  3:35 UTC (permalink / raw)
  To: Jens Axboe, Bart Van Assche, fio
  Cc: Damien Le Moal, Shinichiro Kawasaki, Aravind Ramesh,
	Naohiro Aota, Niklas Cassel, Dmitry Fomichev

The Coverity annotation added earlier to suppress a false positive
about missing unlock in zbd_adjust_block() didn't work because it
was placed not before the return statement, but earlier in the code.

Move the annotation to the right place to avoid the warning.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 8e4b2e55512f("zbd: don't unlock zone mutex after verify replay")
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
---
 zbd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/zbd.c b/zbd.c
index 4710645d..6a26fe10 100644
--- a/zbd.c
+++ b/zbd.c
@@ -1620,12 +1620,6 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
 	case DDIR_READ:
 		if (td->runstate == TD_VERIFYING && td_write(td)) {
 			zb = zbd_replay_write_order(td, io_u, zb);
-			/*
-			 * Since we return with the zone lock still held,
-			 * add an annotation to let Coverity know that it
-			 * is intentional.
-			 */
-			/* coverity[missing_unlock] */
 			goto accept;
 		}
 		/*
@@ -1786,6 +1780,12 @@ accept:
 	assert(!io_u->zbd_put_io);
 	io_u->zbd_queue_io = zbd_queue_io;
 	io_u->zbd_put_io = zbd_put_io;
+	/*
+	 * Since we return with the zone lock still held,
+	 * add an annotation to let Coverity know that it
+	 * is intentional.
+	 */
+	/* coverity[missing_unlock] */
 	return io_u_accept;
 
 eof:
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] zbd: relocate Coverity annotation
  2021-01-30  3:35 [PATCH] zbd: relocate Coverity annotation Dmitry Fomichev
@ 2021-01-30  5:07 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-01-30  5:07 UTC (permalink / raw)
  To: Dmitry Fomichev, Bart Van Assche, fio
  Cc: Damien Le Moal, Shinichiro Kawasaki, Aravind Ramesh,
	Naohiro Aota, Niklas Cassel

On 1/29/21 8:35 PM, Dmitry Fomichev wrote:
> The Coverity annotation added earlier to suppress a false positive
> about missing unlock in zbd_adjust_block() didn't work because it
> was placed not before the return statement, but earlier in the code.
> 
> Move the annotation to the right place to avoid the warning.

Not a fan of these annotations in general, especially when they
are specific to a single code analyzer. But since we already have
them... Applied.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-30  5:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30  3:35 [PATCH] zbd: relocate Coverity annotation Dmitry Fomichev
2021-01-30  5:07 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.