Commit ee3a0e98 authored by roel0's avatar roel0

Resolved coverity issues + working solutions for libsubunit

parent 84c2da5a
......@@ -10,7 +10,7 @@ SIZE:=$(CROSS_COMPILE)size
STRIP_BIN:=$(CROSS_COMPILE)strip
TEST_LDFLAGS=-pthread $(PREFIX)/modules/*.o $(PREFIX)/lib/*.o -lvdeplug
UNIT_LDFLAGS=-lcheck -lm -pthread -lrt
ifeq (,$(wildcard /etc/debian-release))
ifneq ("$(wildcard /etc/debian-release)","")
UNIT_LDFLAGS+=-lsubunit
endif
UNIT_CFLAGS= $(CFLAGS) -Wno-missing-braces
......
......@@ -360,6 +360,7 @@ int32_t MOCKABLE pico_ethernet_send(struct pico_frame *f)
struct pico_eth dstmac;
uint8_t dstmac_valid = 0;
uint16_t proto = PICO_IDETH_IPV4;
uint32_t len = f->len;
#ifdef PICO_SUPPORT_IPV6
/* Step 1: If the frame has an IPv6 packet,
......@@ -372,7 +373,7 @@ int32_t MOCKABLE pico_ethernet_send(struct pico_frame *f)
* frame, otherwise we have a duplicate in IPv6-ND */
pico_ipv6_nd_postpone(f);
pico_frame_discard(f);
return (int32_t)f->len;
return (int32_t)len;
}
dstmac_valid = 1;
......@@ -429,12 +430,11 @@ int32_t MOCKABLE pico_ethernet_send(struct pico_frame *f)
memcpy(hdr->daddr, &dstmac, PICO_SIZE_ETH);
hdr->proto = proto;
}
len = f->len;
if (pico_ethsend_local(f, hdr) || pico_ethsend_bcast(f) || pico_ethsend_dispatch(f)) {
/* one of the above functions has delivered the frame accordingly.
* (returned != 0). It is safe to directly return successfully.
* Lower level queue has frame, so don't discard */
return (int32_t)f->len;
* (returned != 0). It is safe to directly return successfully. */
return (int32_t)len;
}
}
}
......
......@@ -479,13 +479,13 @@ static void pico_nd_trigger_queued_packets(struct pico_ip6 *dst)
n->frames_queued--;
}
if (pico_datalink_send(frame) <= 0) {
pico_frame_discard(frame);
} else {
pico_tree_delete(&IPV6NQueue, frame);
if (pico_datalink_send(frame) > 0) {
nd_dbg("ND-TRIGGER: FRAME SENT\n");
} else {
pico_frame_discard(frame);
}
pico_tree_delete(&IPV6NQueue,frame);
}
}
}
......@@ -512,6 +512,7 @@ static struct pico_ipv6_router *pico_nd_create_rce(struct pico_ipv6_neighbor *n)
nd_dbg("Could not insert router in rcache\n");
PICO_FREE(r);
n->is_router = 0;
return NULL;
}
return r;
......@@ -648,7 +649,9 @@ static struct pico_eth *pico_nd_get_neighbor(struct pico_ip6 *addr, struct pico_
if (!n) {
nd_dbg("no NCE yet, create one\n");
n = pico_nd_create_entry(addr, dev);
if((n = pico_nd_create_entry(addr, dev)) == NULL) {
return NULL;
}
}
if (n->state == PICO_ND_STATE_INCOMPLETE) {
......@@ -1739,7 +1742,7 @@ static int radv_process(struct pico_frame *f)
link = pico_ipv6_link_add_local(f->dev, prefix);
if (link) {
pico_ipv6_lifetime_set(link, now + (pico_time)(1000 * (long_be(prefix_option.val_lifetime))));
pico_ipv6_lifetime_set(link, now + (pico_time)1000 * (pico_time)(long_be(prefix_option.val_lifetime)));
pico_ipv6_set_router_link(&hdr->src, link);
if (!pico_nd_get_default_router()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment