未验证 提交 3e39d455 编写于 作者: P Paul Guo 提交者: GitHub

Fix issues which were reported by coverity. (#7120)

Reviewed-by Adam Berlin
上级 b1492bb7
......@@ -502,7 +502,7 @@ static ICGlobalControlInfo ic_control_info;
*
*/
#define UNACK_QUEUE_RING_SLOTS_NUM (2000)
#define TIMER_SPAN (Gp_interconnect_timer_period * 1000) /* default: 5ms */
#define TIMER_SPAN (Gp_interconnect_timer_period * 1000ULL) /* default: 5ms */
#define TIMER_CHECKING_PERIOD (Gp_interconnect_timer_checking_period) /* default: 20ms */
#define UNACK_QUEUE_RING_LENGTH (UNACK_QUEUE_RING_SLOTS_NUM * TIMER_SPAN)
......@@ -1874,28 +1874,29 @@ sendStatusQueryMessage(MotionConn *conn, int fd, uint32 seq)
static void
putRxBufferAndSendAck(MotionConn *conn, AckSendParam *param)
{
icpkthdr *buf = NULL;
icpkthdr *buf;
uint32 seq;
buf = (icpkthdr *) conn->pkt_q[conn->pkt_q_head];
uint32 seq = buf->seq;
#ifdef AMS_VERBOSE_LOGGING
elog(LOG, "putRxBufferAndSendAck conn %p pkt [seq %d] for node %d route %d, [head seq] %d queue size %d, queue head %d queue tail %d", conn, buf->seq, buf->motNodeId, conn->route, conn->conn_info.seq - conn->pkt_q_size, conn->pkt_q_size, conn->pkt_q_head, conn->pkt_q_tail);
#endif
if (buf == NULL)
{
pthread_mutex_unlock(&ic_control_info.lock);
elog(FATAL, "putRxBufferAndSendAck: buffer is NULL");
}
seq = buf->seq;
#ifdef AMS_VERBOSE_LOGGING
elog(LOG, "putRxBufferAndSendAck conn %p pkt [seq %d] for node %d route %d, [head seq] %d queue size %d, queue head %d queue tail %d", conn, seq, buf->motNodeId, conn->route, conn->conn_info.seq - conn->pkt_q_size, conn->pkt_q_size, conn->pkt_q_head, conn->pkt_q_tail);
#endif
conn->pkt_q[conn->pkt_q_head] = NULL;
conn->pBuff = NULL;
conn->pkt_q_head = (conn->pkt_q_head + 1) % conn->pkt_q_capacity;
conn->pkt_q_size--;
#ifdef AMS_VERBOSE_LOGGING
elog(LOG, "putRxBufferAndSendAck conn %p pkt [seq %d] for node %d route %d, [head seq] %d queue size %d, queue head %d queue tail %d", conn, buf->seq, buf->motNodeId, conn->route, conn->conn_info.seq - conn->pkt_q_size, conn->pkt_q_size, conn->pkt_q_head, conn->pkt_q_tail);
elog(LOG, "putRxBufferAndSendAck conn %p pkt [seq %d] for node %d route %d, [head seq] %d queue size %d, queue head %d queue tail %d", conn, seq, buf->motNodeId, conn->route, conn->conn_info.seq - conn->pkt_q_size, conn->pkt_q_size, conn->pkt_q_head, conn->pkt_q_tail);
#endif
putRxBufferToFreeList(&rx_buffer_pool, buf);
......@@ -3522,7 +3523,7 @@ TeardownUDPIFCInterconnect_Internal(ChunkTransportState *transportStates,
elog((gp_interconnect_log_stats ? LOG : DEBUG1), "Interconnect State: "
"isSender %d isReceiver %d "
"snd_queue_depth %d recv_queue_depth %d Gp_max_packet_size %d "
"UNACK_QUEUE_RING_SLOTS_NUM %d TIMER_SPAN %d DEFAULT_RTT %d "
"UNACK_QUEUE_RING_SLOTS_NUM %d TIMER_SPAN %lld DEFAULT_RTT %d "
"forceEOS %d, gp_interconnect_id %d ic_id_last_teardown %d "
"snd_buffer_pool.count %d snd_buffer_pool.maxCount %d snd_sock_bufsize %d recv_sock_bufsize %d "
"snd_pkt_count %d retransmits %d crc_errors %d"
......
......@@ -835,7 +835,7 @@ numeric_shift_right(Numeric n, unsigned count)
Datum divisor_numeric;
Datum result;
divisor_int64 = Int64GetDatum((int64) (1 << count));
divisor_int64 = Int64GetDatum((int64) (1LL << count));
divisor_numeric = DirectFunctionCall1(int8_numeric, divisor_int64);
result = DirectFunctionCall2(numeric_div_trunc, d, divisor_numeric);
return DatumGetNumeric(result);
......
......@@ -912,6 +912,12 @@ typedef NameData *Name;
strncpy(_dst, (src), _len); \
_dst[_len-1] = '\0'; \
} \
else \
/* upstream does not have the branch code. Without this, coverity \
* warns potential len as 0 (e.g. potential overflow though with \
* low probability, etc) in some code. \
*/ \
_dst[0] = '\0'; \
} while (0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册