linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: fix remoteport access
@ 2018-11-02 15:35 Arnd Bergmann
  2018-11-05  7:52 ` Johannes Thumshirn
  2018-11-06  3:35 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-11-02 15:35 UTC (permalink / raw)
  To: James Smart, Dick Kennedy, James E.J. Bottomley, Martin K. Petersen
  Cc: Arnd Bergmann, Hannes Reinecke, Johannes Thumshirn,
	Vasyl Gomonovych, YueHaibing, linux-scsi, linux-kernel

The addition of a spinlock in lpfc_debugfs_nodelist_data() introduced
a bug that lets us not skip NULL pointers correctly, as noticed by
gcc-8:

drivers/scsi/lpfc/lpfc_debugfs.c: In function 'lpfc_debugfs_nodelist_data.constprop':
drivers/scsi/lpfc/lpfc_debugfs.c:728:13: error: 'nrport' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR)

This changes the logic back to what it was, while keeping the added
spinlock.

Fixes: 9e210178267b ("scsi: lpfc: Synchronize access to remoteport via rport")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/lpfc/lpfc_debugfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 0c8005bb0f53..34d311a7dbef 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -698,6 +698,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
 		rport = lpfc_ndlp_get_nrport(ndlp);
 		if (rport)
 			nrport = rport->remoteport;
+		else
+			nrport = NULL;
 		spin_unlock(&phba->hbalock);
 		if (!nrport)
 			continue;
-- 
2.18.0


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

* Re: [PATCH] scsi: lpfc: fix remoteport access
  2018-11-02 15:35 [PATCH] scsi: lpfc: fix remoteport access Arnd Bergmann
@ 2018-11-05  7:52 ` Johannes Thumshirn
  2018-11-06  3:35 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2018-11-05  7:52 UTC (permalink / raw)
  To: Arnd Bergmann, James Smart, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen
  Cc: Hannes Reinecke, Vasyl Gomonovych, YueHaibing, linux-scsi, linux-kernel

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                        SUSE Labs
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

* Re: [PATCH] scsi: lpfc: fix remoteport access
  2018-11-02 15:35 [PATCH] scsi: lpfc: fix remoteport access Arnd Bergmann
  2018-11-05  7:52 ` Johannes Thumshirn
@ 2018-11-06  3:35 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2018-11-06  3:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: James Smart, Dick Kennedy, James E.J. Bottomley,
	Martin K. Petersen, Hannes Reinecke, Johannes Thumshirn,
	Vasyl Gomonovych, YueHaibing, linux-scsi, linux-kernel


Arnd,

> The addition of a spinlock in lpfc_debugfs_nodelist_data() introduced
> a bug that lets us not skip NULL pointers correctly, as noticed by
> gcc-8:

Applied to 4.20/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2018-11-06  3:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-02 15:35 [PATCH] scsi: lpfc: fix remoteport access Arnd Bergmann
2018-11-05  7:52 ` Johannes Thumshirn
2018-11-06  3:35 ` Martin K. Petersen

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).