Merge pull request #274 from bonzini/for-gcc-8
Fix warnings from Coverity and GCC 8
This commit is contained in:
@@ -29,6 +29,7 @@ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror],
|
|||||||
|
|
||||||
if test "$ac_cv_prog_gcc" = yes; then
|
if test "$ac_cv_prog_gcc" = yes; then
|
||||||
WARN_CFLAGS="-Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing"
|
WARN_CFLAGS="-Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing"
|
||||||
|
WARN_CFLAGS="$WARN_CFLAGS -Wno-unknown-warning-option -Wno-stringop-truncation"
|
||||||
if test "x$enable_werror" != "xno"; then
|
if test "x$enable_werror" != "xno"; then
|
||||||
WARN_CFLAGS="$WARN_CFLAGS -Werror"
|
WARN_CFLAGS="$WARN_CFLAGS -Werror"
|
||||||
fi
|
fi
|
||||||
|
|||||||
38
lib/iser.c
38
lib/iser.c
@@ -964,7 +964,7 @@ iser_post_recvm(struct iser_conn *iser_conn, int count)
|
|||||||
iser_conn->post_recv_buf_count += count;
|
iser_conn->post_recv_buf_count += count;
|
||||||
ret = ibv_post_recv(iser_conn->qp, iser_conn->rx_wr, &rx_wr_failed);
|
ret = ibv_post_recv(iser_conn->qp, iser_conn->rx_wr, &rx_wr_failed);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
iscsi_set_error(iscsi, "ib_post_recv failed ret=%d", ret);
|
iscsi_set_error(iscsi, "posting %d rx bufs, ib_post_recv failed ret=%d", count, ret);
|
||||||
iser_conn->post_recv_buf_count -= count;
|
iser_conn->post_recv_buf_count -= count;
|
||||||
} else
|
} else
|
||||||
iser_conn->rx_desc_head = my_rx_head;
|
iser_conn->rx_desc_head = my_rx_head;
|
||||||
@@ -1028,7 +1028,7 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc,
|
|||||||
struct iser_conn *iser_conn)
|
struct iser_conn *iser_conn)
|
||||||
{
|
{
|
||||||
struct iscsi_in_pdu *in = NULL;
|
struct iscsi_in_pdu *in = NULL;
|
||||||
int outstanding, count = 0, err;
|
int empty, err;
|
||||||
struct iscsi_context *iscsi = iser_conn->cma_id->context;
|
struct iscsi_context *iscsi = iser_conn->cma_id->context;
|
||||||
|
|
||||||
in = iscsi_malloc(iscsi, sizeof(*in));
|
in = iscsi_malloc(iscsi, sizeof(*in));
|
||||||
@@ -1037,12 +1037,13 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc,
|
|||||||
if (iscsi->session_type == ISCSI_SESSION_NORMAL) {
|
if (iscsi->session_type == ISCSI_SESSION_NORMAL) {
|
||||||
if(iser_alloc_rx_descriptors(iser_conn,255)) {
|
if(iser_alloc_rx_descriptors(iser_conn,255)) {
|
||||||
iscsi_set_error(iscsi, "iser_alloc_rx_descriptors Failed\n");
|
iscsi_set_error(iscsi, "iser_alloc_rx_descriptors Failed\n");
|
||||||
return -1;
|
err = -1;
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
err = iser_post_recvm(iser_conn, ISER_MIN_POSTED_RX);
|
err = iser_post_recvm(iser_conn, ISER_MIN_POSTED_RX);
|
||||||
if (err) {
|
if (err) {
|
||||||
iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err);
|
err = -1;
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in->hdr = (unsigned char*)rx_desc->iscsi_header;
|
in->hdr = (unsigned char*)rx_desc->iscsi_header;
|
||||||
@@ -1089,34 +1090,27 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc,
|
|||||||
ISCSI_LIST_ADD_END(&iser_conn->tx_desc, iser_pdu->desc);
|
ISCSI_LIST_ADD_END(&iser_conn->tx_desc, iser_pdu->desc);
|
||||||
|
|
||||||
nop_target:
|
nop_target:
|
||||||
|
|
||||||
/* decrementing conn->post_recv_buf_count only --after-- freeing the *
|
/* decrementing conn->post_recv_buf_count only --after-- freeing the *
|
||||||
* task eliminates the need to worry on tasks which are completed in *
|
* task eliminates the need to worry on tasks which are completed in *
|
||||||
* parallel to the execution of iser_conn_term. So the code that waits *
|
* parallel to the execution of iser_conn_term. So the code that waits *
|
||||||
* for the posted rx bufs refcount to become zero handles everything */
|
* for the posted rx bufs refcount to become zero handles everything */
|
||||||
iser_conn->post_recv_buf_count--;
|
iser_conn->post_recv_buf_count--;
|
||||||
|
|
||||||
if ((unsigned char *)rx_desc == iser_conn->login_resp_buf)
|
if ((unsigned char *)rx_desc != iser_conn->login_resp_buf) {
|
||||||
goto receive;
|
empty = iser_conn->qp_max_recv_dtos - iser_conn->post_recv_buf_count;
|
||||||
|
if (empty >= iser_conn->min_posted_rx) {
|
||||||
outstanding = iser_conn->post_recv_buf_count;
|
err = iser_post_recvm(iser_conn, empty);
|
||||||
if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) {
|
if (err) {
|
||||||
if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx)
|
err = -1;
|
||||||
count = iser_conn->min_posted_rx;
|
goto error;
|
||||||
else
|
}
|
||||||
count = iser_conn->qp_max_recv_dtos - outstanding;
|
|
||||||
err = iser_post_recvm(iser_conn, count);
|
|
||||||
if (err) {
|
|
||||||
iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
receive:
|
|
||||||
|
|
||||||
err = iscsi_process_pdu(iscsi, in);
|
err = iscsi_process_pdu(iscsi, in);
|
||||||
iscsi_free(iscsi, in);
|
|
||||||
|
|
||||||
|
error:
|
||||||
|
iscsi_free(iscsi, in);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ iscsi_log_message(struct iscsi_context *iscsi, int level, const char *format, ..
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iscsi->target_name[0]) {
|
if (iscsi->target_name[0]) {
|
||||||
static char message2[1024];
|
static char message2[1282];
|
||||||
|
|
||||||
snprintf(message2, 1024, "%s [%s]", message, iscsi->target_name);
|
snprintf(message2, 1282, "%s [%s]", message, iscsi->target_name);
|
||||||
iscsi->log_fn(level, message2);
|
iscsi->log_fn(level, message2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1086,6 +1086,7 @@ scsi_maintenancein_datain_getfullsize(struct scsi_task *task)
|
|||||||
(task_get_uint8(task, 1) & 0x80) ? 12 : 0 +
|
(task_get_uint8(task, 1) & 0x80) ? 12 : 0 +
|
||||||
task_get_uint16(task, 2);
|
task_get_uint16(task, 2);
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
14
lib/sync.c
14
lib/sync.c
@@ -88,10 +88,8 @@ iscsi_sync_cb(struct iscsi_context *iscsi _U_, int status,
|
|||||||
{
|
{
|
||||||
struct iscsi_sync_state *state = private_data;
|
struct iscsi_sync_state *state = private_data;
|
||||||
|
|
||||||
if (state != NULL) {
|
state->status = status;
|
||||||
state->status = status;
|
state->finished = 1;
|
||||||
state->finished = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1871,11 +1869,9 @@ iscsi_discovery_cb(struct iscsi_context *iscsi _U_, int status,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != NULL) {
|
state->status = status;
|
||||||
state->status = status;
|
state->finished = 1;
|
||||||
state->finished = 1;
|
state->ptr = dahead;
|
||||||
state->ptr = dahead;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct iscsi_discovery_address *
|
struct iscsi_discovery_address *
|
||||||
|
|||||||
Reference in New Issue
Block a user