From: Colin Ian King Date: Tue, 2 Jul 2019 09:18:35 +0000 (+0100) Subject: scsi: libfc: fix null pointer dereference on a null lport X-Git-Tag: v5.15~5866^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=41a6bf6529edd10a6def42e3b2c34a7474bcc2f5;p=platform%2Fkernel%2Flinux-starfive.git scsi: libfc: fix null pointer dereference on a null lport Currently if lport is null then the null lport pointer is dereference when printing out debug via the FC_LPORT_DB macro. Fix this by using the more generic FC_LIBFC_DBG debug macro instead that does not use lport. Addresses-Coverity: ("Dereference after null check") Fixes: 7414705ea4ae ("libfc: Add runtime debugging with debug_logging module parameter") Signed-off-by: Colin Ian King Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 025cd2ff..0c87b97 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2591,7 +2591,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) /* lport lock ? */ if (!lport || lport->state == LPORT_ST_DISABLED) { - FC_LPORT_DBG(lport, "Receiving frames for an lport that " + FC_LIBFC_DBG("Receiving frames for an lport that " "has not been initialized correctly\n"); fc_frame_free(fp); return;