Skip to content

Commit

Permalink
qpb: Tell coverity the actual size we are copying
Browse files Browse the repository at this point in the history
`struct prefix` is a superset of `struct prefix_ipv4` and
`struct prefix_ipv6`.  Let's let coverity figure it out

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Aug 2, 2022
1 parent 8372176 commit 529766f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qpb/qpb.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ static inline int qpb__l3_prefix__get(const Qpb__L3Prefix *pb_prefix,
switch (family) {

case AF_INET:
memset(prefix, 0, sizeof(struct prefix_ipv4));
memset((struct prefix_ipv4 *)prefix, 0,
sizeof(struct prefix_ipv4));
break;

case AF_INET6:
memset(prefix, 0, sizeof(struct prefix_ipv6));
memset((struct prefix_ipv6 *)prefix, 0,
sizeof(struct prefix_ipv6));
break;

default:
Expand Down

0 comments on commit 529766f

Please sign in to comment.