laforge has submitted this change. (
https://gerrit.osmocom.org/c/libosmocore/+/38501?usp=email )
Change subject: netdev: Explicit cast time() to uint32_t seq_nr
......................................................................
netdev: Explicit cast time() to uint32_t seq_nr
Make coverity happy and also inform readers of the code that we are fine
dropping the most significat part of the return value of time() when
using it to set up a nl seq_nr.
Related: Coverity CID#426078
Change-Id: Ia4c1c9b2dcc751b6cbd01a957627f882bc63ba87
---
M src/core/netdev.c
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/core/netdev.c b/src/core/netdev.c
index 8e7fc28..1e886f9 100644
--- a/src/core/netdev.c
+++ b/src/core/netdev.c
@@ -479,7 +479,7 @@
nlh->nlmsg_type = RTM_GETLINK;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
- nlh->nlmsg_seq = time(NULL);
+ nlh->nlmsg_seq = (uint32_t)time(NULL);
ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm));
ifm->ifi_family = AF_UNSPEC;
@@ -512,7 +512,7 @@
nlh->nlmsg_type = RTM_NEWLINK;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
- nlh->nlmsg_seq = time(NULL);
+ nlh->nlmsg_seq = (uint32_t)time(NULL);
ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm));
ifm->ifi_family = AF_UNSPEC;
@@ -542,7 +542,7 @@
nlh->nlmsg_type = RTM_NEWLINK;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
- nlh->nlmsg_seq = time(NULL);
+ nlh->nlmsg_seq = (uint32_t)time(NULL);
ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm));
ifm->ifi_family = AF_UNSPEC;
@@ -568,7 +568,7 @@
nlh->nlmsg_type = RTM_NEWADDR;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE | NLM_F_ACK;
- nlh->nlmsg_seq = time(NULL);
+ nlh->nlmsg_seq = (uint32_t)time(NULL);
ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm));
ifm->ifa_family = osa->u.sa.sa_family;
@@ -616,7 +616,7 @@
nlh->nlmsg_type = RTM_NEWROUTE;
nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_ACK;
- nlh->nlmsg_seq = time(NULL);
+ nlh->nlmsg_seq = (uint32_t)time(NULL);
rtm = mnl_nlmsg_put_extra_header(nlh, sizeof(*rtm));
rtm->rtm_family = dst_osa->u.sa.sa_family;
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/38501?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia4c1c9b2dcc751b6cbd01a957627f882bc63ba87
Gerrit-Change-Number: 38501
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>