LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH] scsi: libfc: drop an incorrect assertion
@ 2018-07-11 20:15 Arnd Bergmann
  0 siblings, 0 replies; 1+ messages in thread
From: Arnd Bergmann @ 2018-07-11 20:15 UTC (permalink / raw)
  To: Johannes Thumshirn, James E.J. Bottomley, Martin K. Petersen
  Cc: Arnd Bergmann, Hannes Reinecke, Satish Kharat, linux-scsi, linux-kernel

gcc points out one case in which the added lockdep_assert_held()
is wrong:

In file included from include/linux/spinlock_types.h:18,
                 from include/linux/spinlock.h:82,
                 from drivers/scsi/libfc/fc_rport.c:61:
drivers/scsi/libfc/fc_rport.c: In function 'fc_rport_recv_plogi_req':
include/linux/lockdep.h:347:45: error: 'rdata' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define lockdep_is_held(lock)  lock_is_held(&(lock)->dep_map)
                                             ^
drivers/scsi/libfc/fc_rport.c:1832:24: note: 'rdata' was declared here
  struct fc_rport_priv *rdata;

The pointer to the lock is not initialized here, so besides the
compile-time warning, this will likely lead to an immediate
crash when dereferencing that pointer.

Fixes: ee35624e1e4e ("scsi: libfc: Add lockdep annotations")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/libfc/fc_rport.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 6aff9303251a..be640ad2b7b6 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -1835,8 +1835,6 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
 	struct fc_seq_els_data rjt_data;
 	u32 sid;
 
-	lockdep_assert_held(&rdata->rp_mutex);
-
 	sid = fc_frame_sid(fp);
 
 	FC_RPORT_ID_DBG(lport, sid, "Received PLOGI request\n");
-- 
2.9.0


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

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 20:15 [PATCH] scsi: libfc: drop an incorrect assertion Arnd Bergmann

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox