From 885c8244cf3c489aac096202486e4d20491612f4 Mon Sep 17 00:00:00 2001 From: "F. Aragon" Date: Mon, 2 Jul 2018 16:44:46 +0200 Subject: [PATCH] eigrpd: sizeof() usage + dead code (PVS-Studio) Two issues: 1) Removed an unnecesary null check of 'ei' 2) Fixed the usage of sizeof(), as it was used the size of a pointer instead of the size of the structure Signed-off-by: F. Aragon --- eigrpd/eigrp_packet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index fab21e5201..027f30563f 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -566,7 +566,7 @@ int eigrp_read(struct thread *thread) // return -1; /* If incoming interface is passive one, ignore it. */ - if (ei && eigrp_if_is_passive(ei)) { + if (eigrp_if_is_passive(ei)) { char buf[3][INET_ADDRSTRLEN]; if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) @@ -725,12 +725,12 @@ static struct stream *eigrp_recv_packet(int fd, struct interface **ifp, zlog_warn("stream_recvmsg failed: %s", safe_strerror(errno)); return NULL; } - if ((unsigned int)ret < sizeof(iph)) /* ret must be > 0 now */ + if ((unsigned int)ret < sizeof(*iph)) /* ret must be > 0 now */ { zlog_warn( "eigrp_recv_packet: discarding runt packet of length %d " "(ip header size is %u)", - ret, (unsigned int)sizeof(iph)); + ret, (unsigned int)sizeof(*iph)); return NULL; } -- 2.39.5