Skip to contentSkip to conversation

Change in openvpn[master]: schedule: Fix conversion warning

Openvpn-devel Superseded flichtenheld (Code Review) 2 participants 6 messages Oct 13, 2025 1 message not in the archive

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1760359115000.I5e6cb3a287a2e8e1584036307b4c21bb68050c6a@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email

to review the following change.

Change subject: schedule: Fix conversion warning
......................................................................

schedule: Fix conversion warning

Return value of random() is safe to cast.

Change-Id I5e6cb3a287a2e8e1584036307b4c21bb68050c6a

---
M src/openvpn/schedule.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/1270/1

src/openvpn/schedule.c +1 -10
index 1389889..bf6693f 100644
@@ -65,25 +65,16 @@
 }
 #endif
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline void
 schedule_set_pri(struct schedule_entry *e)
 {
-    e->pri = random();
+    e->pri = (unsigned int)random();
     if (e->pri < 1)
     {
         e->pri = 1;
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /* This is the master key comparison routine.  A key is
  * simply a struct timeval containing the absolute time for
  * an event.  The unique treap priority (pri) is used to ensure

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Gerrit-Change-Number: 1270
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email )

Change subject: schedule: Fix conversion warning
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Gerrit-Change-Number: 1270
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Oct 2025 16:22:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 schedule: Fix conversion warning

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Return value of random() is safe to cast.

Change-Id I5e6cb3a287a2e8e1584036307b4c21bb68050c6a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/schedule.c +1 -10
index 1389889..bf6693f 100644
@@ -65,25 +65,16 @@
 }
 #endif
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline void
 schedule_set_pri(struct schedule_entry *e)
 {
-    e->pri = random();
+    e->pri = (unsigned int)random();
     if (e->pri < 1)
     {
         e->pri = 1;
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /* This is the master key comparison routine.  A key is
  * simply a struct timeval containing the absolute time for
  * an event.  The unique treap priority (pri) is used to ensure
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: schedule: Fix conversion warning

Trivial enough... and should we really end up loosing a few bits, it just does not matter at this point.

Your patch has been applied to the master branch.

commit f79221a9e0ee0ce4100b02ac5070f9d18fc7e8a8

Author: Frank Lichtenheld
Date:   Mon Oct 13 18:23:08 2025 +0200
     schedule: Fix conversion warning

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: schedule: Fix conversion warning
......................................................................

schedule: Fix conversion warning

Return value of random() is safe to cast.

Change-Id I5e6cb3a287a2e8e1584036307b4c21bb68050c6a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/

---
M src/openvpn/schedule.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/1270/2

src/openvpn/schedule.c +1 -10
index 1389889..bf6693f 100644
@@ -65,25 +65,16 @@
 }
 #endif
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline void
 schedule_set_pri(struct schedule_entry *e)
 {
-    e->pri = random();
+    e->pri = (unsigned int)random();
     if (e->pri < 1)
     {
         e->pri = 1;
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /* This is the master key comparison routine.  A key is
  * simply a struct timeval containing the absolute time for
  * an event.  The unique treap priority (pri) is used to ensure

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Gerrit-Change-Number: 1270
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email )

Change subject: schedule: Fix conversion warning
......................................................................

schedule: Fix conversion warning

Return value of random() is safe to cast.

Change-Id I5e6cb3a287a2e8e1584036307b4c21bb68050c6a

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/

---
M src/openvpn/schedule.c

1 file changed, 1 insertion(+), 10 deletions(-)
src/openvpn/schedule.c +1 -10
index 1389889..bf6693f 100644
@@ -65,25 +65,16 @@
 }
 #endif
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline void
 schedule_set_pri(struct schedule_entry *e)
 {
-    e->pri = random();
+    e->pri = (unsigned int)random();
     if (e->pri < 1)
     {
         e->pri = 1;
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /* This is the master key comparison routine.  A key is
  * simply a struct timeval containing the absolute time for
  * an event.  The unique treap priority (pri) is used to ensure
Signature · 13 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1270?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Gerrit-Change-Number: 1270
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>