KA10: Fixed some coverity errors.

This commit is contained in:
Richard Cornwell 2022-03-10 19:12:46 -05:00
parent 894871f64d
commit 9b2f13d443
3 changed files with 8 additions and 2 deletions

View file

@ -1080,6 +1080,8 @@ void nia_packet_debug(struct nia_device *nia, const char *action,
case ICMP_PROTO:
icmp = (struct icmp *)payload;
len = ntohs(ip->ip_len) - (ip->ip_v_hl & 0xf) * 4;
if (len > 1500)
len = 1500;
sim_debug(DEBUG_ICMP, &nia_dev, "%s %s %d byte packet from %s to %s\n", action,
(icmp->type < sizeof(icmp_types)/sizeof(icmp_types[0])) ? icmp_types[icmp->type] : "", (int)len, src_ip, dst_ip);
if (len && (nia_dev.dctrl & DEBUG_ICMP))

View file

@ -1028,7 +1028,7 @@ t_stat dev_pi(uint32 dev, uint64 *data) {
res |= ((uint64)(PIR) << 18);
#endif
#if !KL
res |= (parity_irq << 15);
res |= ((uint64)parity_irq << 15);
#endif
*data = res;
sim_debug(DEBUG_CONI, &cpu_dev, "CONI PI %012llo\n", *data);
@ -4058,7 +4058,7 @@ t_stat dev_apr(uint32 dev, uint64 *data) {
res |= (((FLAGS & PCHNG) != 0) << 6) | (pcchg_irq << 7) ;
res |= (clk_flg << 9) | (((uint64)clk_en) << 10) | (nxm_flag << 12);
res |= (mem_prot << 13) | (((FLAGS & USER) != 0) << 14) | (user_io << 15);
res |= (push_ovf << 16);
res |= ((uint64)push_ovf << 16);
*data = res;
sim_debug(DEBUG_CONI, &cpu_dev, "CONI APR %012llo\n", *data);
break;

View file

@ -1508,6 +1508,8 @@ imp_packet_in(struct imp_device *imp)
int i;
char port_buffer[100];
struct udp_hdr udp_hdr;
if (l > 1500)
l = 1500;
/* Count out 4 commas */
for (i = nlen = 0; i < l && nlen < 4; i++) {
if (tcp_payload[i] == ',')
@ -2098,6 +2100,8 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
}
len = ntohs(ip->ip_len) - ((ip->ip_v_hl & 0xf) * 4 + (ntohs(tcp->flags) >> 12) * 4);
if (len > 1500)
len = 1500;
sim_debug(DEBUG_TCP, &imp_dev, "%s %s%s %d byte packet from %s:%s to %s:%s\n", action,
flags, *flags ? ":" : "", (int)len, src_ip, src_port, dst_ip, dst_port);
if (len && (imp_dev.dctrl & DEBUG_TCP))