aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-04-09 07:54:39 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-04-09 07:54:39 +0000
commitbb8cea1b21bd5a5c631399480910f73f5c4b1c6c (patch)
tree03bd23706579945ca903b5b94727de4da618177b /sys/cam/ctl/ctl_frontend_iscsi.c
parente9da70a35ebef64ba7f9a08681f871888d9d3a8c (diff)
downloadsrc-bb8cea1b21bd5a5c631399480910f73f5c4b1c6c.tar.gz
src-bb8cea1b21bd5a5c631399480910f73f5c4b1c6c.zip
Fix few minor issues found by Clang Analyzer.
MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=316653
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 5dcef0035cea..24fcbdf6933e 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -321,11 +321,10 @@ cfiscsi_pdu_handle(struct icl_pdu *request)
static void
cfiscsi_receive_callback(struct icl_pdu *request)
{
+#ifdef ICL_KERNEL_PROXY
struct cfiscsi_session *cs;
cs = PDU_SESSION(request);
-
-#ifdef ICL_KERNEL_PROXY
if (cs->cs_waiting_for_ctld || cs->cs_login_phase) {
if (cs->cs_login_pdu == NULL)
cs->cs_login_pdu = request;
@@ -1709,6 +1708,13 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci)
sbuf_finish(sb);
error = copyout(sbuf_data(sb), cilp->conn_xml, sbuf_len(sb) + 1);
+ if (error != 0) {
+ sbuf_delete(sb);
+ snprintf(ci->error_str, sizeof(ci->error_str),
+ "copyout failed with error %d", error);
+ ci->status = CTL_ISCSI_ERROR;
+ return;
+ }
cilp->fill_len = sbuf_len(sb) + 1;
ci->status = CTL_ISCSI_OK;
sbuf_delete(sb);
@@ -2163,9 +2169,9 @@ cfiscsi_ioctl_port_create(struct ctl_req *req)
retval = ctl_port_register(port);
if (retval != 0) {
ctl_free_opts(&port->options);
- cfiscsi_target_release(ct);
free(port->port_devid, M_CFISCSI);
free(port->target_devid, M_CFISCSI);
+ cfiscsi_target_release(ct);
req->status = CTL_LUN_ERROR;
snprintf(req->error_str, sizeof(req->error_str),
"ctl_port_register() failed with error %d", retval);