linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Mike Snitzer <snitzer@kernel.org>,
	dm-devel@redhat.com
Cc: kbuild@lists.01.org, lkp@intel.com, kbuild-all@lists.01.org,
	Mike Snitzer <snitzer@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] dm-writecache: drop the lock on an 'impossible' path
Date: Mon, 8 Aug 2022 10:50:10 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2208081034050.8160@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <202208050301.roHRxc6O-lkp@intel.com>



On Fri, 5 Aug 2022, Dan Carpenter wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   b44f2fd87919b5ae6e1756d4c7ba2cbba22238e1
> commit: df699cc16ea5ef93a917676dcdd4376e02860ad5 dm writecache: report invalid return from writecache_map helpers
> config: arc-randconfig-m041-20220804 (https://download.01.org/0day-ci/archive/20220805/202208050301.roHRxc6O-lkp@intel.com/config)
> compiler: arc-elf-gcc (GCC) 12.1.0
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> drivers/md/dm-writecache.c:1554 writecache_map() warn: inconsistent returns '&wc->lock'.

Hi

Here I'm sending a patch for this warning.

Mikulas



From: Mikulas Patocka <mpatocka@redhat.com>

There's a smatch warning "inconsistent returns '&wc->lock'" in
dm-writecache. The reason for the warning is that the function
writecache_map doesn't drop the lock on the impossible path. This patch
adds wc_unlock after the BUG statement (so that it will be compiled-away
anyway) to fix the warning.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Index: linux-2.6/drivers/md/dm-writecache.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-writecache.c
+++ linux-2.6/drivers/md/dm-writecache.c
@@ -1598,7 +1598,8 @@ done:
 
 	default:
 		BUG();
-		return -1;
+		wc_unlock(wc);
+		return DM_MAPIO_KILL;
 	}
 }
 


      reply	other threads:[~2022-08-08 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  9:08 drivers/md/dm-writecache.c:1554 writecache_map() warn: inconsistent returns '&wc->lock' Dan Carpenter
2022-08-08 14:50 ` Mikulas Patocka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.02.2208081034050.8160@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dm-devel@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=snitzer@kernel.org \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).