ndisc: avoid static analysis complaining about overflow check in receive_ra()

lgtm.com flags this. The check was there to be better safe than sorry.
Also, it seems better to have code that shows what happens instead
of a verbose code comment (or no comment at all). Anyway, avoid the
false positive.
This commit is contained in:
Thomas Haller 2020-05-06 22:29:46 +02:00
parent b447c80ad8
commit 53b2297701
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -179,9 +179,9 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
*/
#define NM_NDISC_VLTIME_MULT ((guint32) 48)
clamp_pltime = ndp_msgra_router_lifetime (msgra);
clamp_vltime = (clamp_pltime < G_MAXUINT32 / NM_NDISC_VLTIME_MULT)
? clamp_pltime * NM_NDISC_VLTIME_MULT
: G_MAXUINT32;
/* clamp_pltime has at most 16 bit set, and multiplication cannot overflow. */
clamp_vltime = clamp_pltime * NM_NDISC_VLTIME_MULT;
ndp_msg_opt_for_each_offset (offset, msg, NDP_MSG_OPT_PREFIX) {
guint8 r_plen;