Skip to content

Instantly share code, notes, and snippets.

@hwchiu
Created April 28, 2017 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwchiu/b1589690743baed0fc90b01897c7a578 to your computer and use it in GitHub Desktop.
Save hwchiu/b1589690743baed0fc90b01897c7a578 to your computer and use it in GitHub Desktop.
result of clang SA
routemap.c:405:7: warning: Access to field 'instance' results in a dereference of a null pointer (loaded from variable 'zlog_default')
if (zlog_default->instance)
^~~~~~~~~~~~~~~~~~~~~~
routemap.c:1689:9: warning: Access to field 'nextrm' results in a dereference of a null pointer (loaded from variable 'index')
index->nextrm,
^~~~~~~~~~~~~
2 warnings generated.
ptm_lib.c:385:13: warning: Branch condition evaluates to a garbage value
if (!p_ctxt) {
^~~~~~~
1 warning generated.
csv.c:186:1: warning: Potential leak of memory pointed to by 'fld'
}
^
csv.c:241:5: warning: Potential leak of memory pointed to by 'str'
log_error("record malloc failed\n");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
csv.c:35:12: note: expanded from macro 'log_error'
do { if (DEBUG_E) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
^~~~~~~
csv.c:31:17: note: expanded from macro 'DEBUG_E'
#define DEBUG_E 1
^
csv.c:297:21: warning: Access to field 'field_len' results in a dereference of a null pointer (loaded from variable 'fld')
for (i = 0; i < fld->field_len; i++) {
^~~~~~~~~~~~~~
3 warnings generated.
vrf.c:41:1: warning: Dereference of null pointer
RB_GENERATE (vrf_id_head, vrf, id_entry, vrf_id_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:463:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
vrf.c:41:1: warning: Dereference of null pointer
RB_GENERATE (vrf_id_head, vrf, id_entry, vrf_id_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:495:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
vrf.c:42:1: warning: Dereference of null pointer
RB_GENERATE (vrf_name_head, vrf, name_entry, vrf_name_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:463:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
vrf.c:42:1: warning: Dereference of null pointer
RB_GENERATE (vrf_name_head, vrf, name_entry, vrf_name_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:495:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
ns.c:46:1: warning: Dereference of null pointer
RB_GENERATE (ns_head, ns, entry, ns_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:463:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
ns.c:46:1: warning: Dereference of null pointer
RB_GENERATE (ns_head, ns, entry, ns_compare)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:396:2: note: expanded from macro 'RB_GENERATE'
RB_GENERATE_INTERNAL(name, type, field, cmp,)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:495:9: note: expanded from macro 'RB_GENERATE_INTERNAL'
if ((RB_LEFT(tmp, field) == NULL || \
^~~~~~~~~~~~~~~~~~~
./openbsd-tree.h:313:30: note: expanded from macro 'RB_LEFT'
#define RB_LEFT(elm, field) (elm)->field.rbe_left
^~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
imsg-buffer.c:213:3: warning: Use of memory after it is freed
ibuf_dequeue(msgbuf, buf);
^~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
imsg.c:55:30: warning: The left operand of '>=' is a garbage value
for (i = 0; i < n && fds[i] >= 0; i++)
~~~~~~ ^
imsg.c:185:2: warning: Null pointer passed as an argument to a 'nonnull' parameter
memcpy(imsg->data, ibuf->r.rptr, datalen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imsg.c:310:7: warning: Use of memory after it is freed
fd = ifd->fd;
^~~~~~~
3 warnings generated.
skiplist.c:442:13: warning: Dereference of null pointer (loaded from variable 'cursor')
*cursor = q;
~~~~~~ ^
1 warning generated.
In file included from zebra_rib.c:42:
In file included from ../zebra/rt.h:30:
In file included from ../zebra/zebra_mpls.h:36:
../zebra/zebra_vrf.h:90:10: warning: Access to field 'vrf' results in a dereference of a null pointer (loaded from variable 'zvrf')
return zvrf->vrf->vrf_id;
^~~~~~~~~
1 warning generated.
interface.c:600:21: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'first')
for (anode = first->next; anode || first; anode = next)
^~~~~~~~~~~
1 warning generated.
In file included from zebra_vrf.c:32:
../zebra/zebra_vrf.h:96:10: warning: Access to field 'vrf' results in a dereference of a null pointer (loaded from variable 'zvrf')
return zvrf->vrf->name;
^~~~~~~~~
1 warning generated.
zebra_static.c:117:9: warning: Function call argument is an uninitialized value
zebra_evaluate_rnh(si->vrf_id, nh_p.family, 1, RNH_NEXTHOP_TYPE, &nh_p);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zebra_static.c:188:11: warning: Function call argument is an uninitialized value
zebra_evaluate_rnh(si->vrf_id, nh_p.family, 1, RNH_NEXTHOP_TYPE, &nh_p);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
zserv.c:1588:5: warning: Function call argument is an uninitialized value
rib_delete (AFI_IP6, api.safi, zvrf_id (zvrf), api.type, api.instance,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
zebra_fpm.c:1625:3: warning: Value stored to 'have_netlink' is never read
have_netlink = have_protobuf = 0;
^ ~~~~~~~~~~~~~~~~~
1 warning generated.
zebra_fpm_netlink.c:261:8: warning: Access to field 'flags' results in a dereference of a null pointer (loaded from variable 'rib')
if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
^~~~~~~~~~
1 warning generated.
kernel_netlink.c:324:3: warning: Null pointer passed as an argument to a 'nonnull' parameter
memcpy (RTA_DATA (rta), data, alen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel_netlink.c:345:3: warning: Null pointer passed as an argument to a 'nonnull' parameter
memcpy (RTA_DATA (subrta), data, alen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
bgpd.c:6028:8: warning: Value stored to 'ret' is never read
ret = peer_ebgp_multihop_set (peer, MAXTTL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
bgp_aspath.c:232:40: warning: Access to field 'as' results in a dereference of a null pointer (loaded from variable 'seg')
newas = XREALLOC (MTYPE_AS_SEG_DATA, seg->as,
^~~~~~~
../lib/memory.h:171:52: note: expanded from macro 'XREALLOC'
#define XREALLOC(mtype, ptr, size) qrealloc(mtype, ptr, size)
^
bgp_aspath.c:1103:20: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'prevseg')
prevseg->next = seg;
~~~~~~~ ^
bgp_aspath.c:1450:14: warning: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'last')
last->next = as2->segments;
~~~~ ^
bgp_aspath.c:2024:11: warning: Value stored to 'p' is never read
return p++;
^~~
4 warnings generated.
bgp_debug.c:429:8: warning: Access to field 'aggregator_as' results in a dereference of a null pointer (loaded from field 'extra')
attr->extra->aggregator_as,
^~~~~~~~~~~~~~~~~~~~~~~~~~
bgp_debug.c:434:19: warning: Access to field 'originator_id' results in a dereference of a null pointer (loaded from field 'extra')
inet_ntoa (attr->extra->originator_id));
^~~~~~~~~~~~~~~~~~~~~~~~~~
bgp_debug.c:441:23: warning: Access to field 'cluster' results in a dereference of a null pointer (loaded from field 'extra')
for (i = 0; i < attr->extra->cluster->length / 4; i++)
^~~~~~~~~~~~~~~~~~~~
3 warnings generated.
bgp_route.c:638:11: warning: Access to field 'cluster' results in a dereference of a null pointer (loaded from field 'extra')
newm = BGP_CLUSTER_LIST_LENGTH(new->attr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../bgpd/bgp_attr.h:194:4: note: expanded from macro 'BGP_CLUSTER_LIST_LENGTH'
(attr)->extra->cluster->length : 0)
^~~~~~~~~~~~~~~~~~~~~~
bgp_route.c:794:19: warning: Access to field 'cluster' results in a dereference of a null pointer (loaded from field 'extra')
exist_cluster = BGP_CLUSTER_LIST_LENGTH(exist->attr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../bgpd/bgp_attr.h:194:4: note: expanded from macro 'BGP_CLUSTER_LIST_LENGTH'
(attr)->extra->cluster->length : 0)
^~~~~~~~~~~~~~~~~~~~~~
bgp_route.c:6566:82: warning: Access to field 'mp_nexthop_global_in' results in a dereference of a null pointer (loaded from field 'extra')
json_object_string_add(json_out, "mpNexthopGlobalIn", inet_ntoa (attr->extra->mp_nexthop_global_in));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bgp_route.c:6568:51: warning: Access to field 'mp_nexthop_global_in' results in a dereference of a null pointer (loaded from field 'extra')
vty_out (vty, "%-16s", inet_ntoa (attr->extra->mp_nexthop_global_in));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment