From: Colin King <colin.king@canonical.com> To: "James E . J . Bottomley" <jejb@linux.vnet.ibm.com>, "Martin K . Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: qla4xxx: check for null return from iscsi_lookup_endpoint Date: Sun, 7 May 2017 22:30:20 +0100 [thread overview] Message-ID: <20170507213020.28354-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> iscsi_lookup_endpoint can potentially return null and in 9 out of the 10 calls to this function a null return is checked, so I think it is pertinent to perform a null check here too and return -EINVAL as in the other null cases. Detected by CoverityScan, CID#147282 ("Dereference null return value") Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 64c6fa563fdb..803e342e1093 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3189,6 +3189,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) return -EINVAL; ep = iscsi_lookup_endpoint(transport_fd); + if (!ep) + return -EINVAL; conn = cls_conn->dd_data; qla_conn = conn->dd_data; qla_conn->qla_ep = ep->dd_data; -- 2.11.0
WARNING: multiple messages have this Message-ID (diff)
From: Colin King <colin.king@canonical.com> To: "James E . J . Bottomley" <jejb@linux.vnet.ibm.com>, "Martin K . Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: qla4xxx: check for null return from iscsi_lookup_endpoint Date: Sun, 07 May 2017 21:30:20 +0000 [thread overview] Message-ID: <20170507213020.28354-1-colin.king@canonical.com> (raw) From: Colin Ian King <colin.king@canonical.com> iscsi_lookup_endpoint can potentially return null and in 9 out of the 10 calls to this function a null return is checked, so I think it is pertinent to perform a null check here too and return -EINVAL as in the other null cases. Detected by CoverityScan, CID#147282 ("Dereference null return value") Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 64c6fa563fdb..803e342e1093 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3189,6 +3189,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) return -EINVAL; ep = iscsi_lookup_endpoint(transport_fd); + if (!ep) + return -EINVAL; conn = cls_conn->dd_data; qla_conn = conn->dd_data; qla_conn->qla_ep = ep->dd_data; -- 2.11.0
next reply other threads:[~2017-05-08 0:09 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-05-07 21:30 Colin King [this message] 2017-05-07 21:30 ` [PATCH] scsi: qla4xxx: check for null return from iscsi_lookup_endpoint Colin King 2017-05-08 12:09 ` Dan Carpenter 2017-05-08 12:09 ` Dan Carpenter
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=20170507213020.28354-1-colin.king@canonical.com \ --to=colin.king@canonical.com \ --cc=jejb@linux.vnet.ibm.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.