Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-11 Thread Steffan Karger
On 11-10-18 13:56, Gert Doering wrote: > On Thu, Oct 11, 2018 at 01:52:37PM +0200, Steffan Karger wrote: >>> I know that Steffan likes using size_t for "things that have a size" >>> but I find it a bit questionable here :-) >> >> So the underlying problem is that "further down" used int to store >>

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-11 Thread Gert Doering
Hi, On Thu, Oct 11, 2018 at 01:52:37PM +0200, Steffan Karger wrote: > > I know that Steffan likes using size_t for "things that have a size" > > but I find it a bit questionable here :-) > > So the underlying problem is that "further down" used int to store > sizes, but since that just is the way

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-11 Thread Steffan Karger
Hi, On 11-10-18 13:23, Gert Doering wrote: > On Thu, Oct 11, 2018 at 01:40:16PM +0300, Lev Stipakov wrote: >>> Since crypto_overhead and crypto_max_overhead() are both size_t, and >>> frame_add_to_extra_frame() is declared to take an "unsigned int" now, >>> this cast should not be necessary. >> >>

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-11 Thread Gert Doering
Hi, On Thu, Oct 11, 2018 at 01:40:16PM +0300, Lev Stipakov wrote: > > Since crypto_overhead and crypto_max_overhead() are both size_t, and > > frame_add_to_extra_frame() is declared to take an "unsigned int" now, > > this cast should not be necessary. > > > Visual Studio disagrees. Without expli

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-11 Thread Lev Stipakov
Hi, > Since crypto_overhead and crypto_max_overhead() are both size_t, and > frame_add_to_extra_frame() is declared to take an "unsigned int" now, > this cast should not be necessary. Visual Studio disagrees. Without explicit cast I got > warning C4267: 'function': conversion from 'size_t' to

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-10 Thread Gert Doering
Hi, On Wed, Oct 10, 2018 at 03:26:17PM +0300, Lev Stipakov wrote: > crypto_overhead += kt->hmac_length; > > -frame_add_to_extra_frame(frame, crypto_overhead); > +frame_add_to_extra_frame(frame, (unsigned int) crypto_overhead); Even if Arne already ACKed it, I have reservations abou

Re: [Openvpn-devel] [PATCH v2] options.c: fix broken unary minus usage

2018-10-10 Thread Arne Schwabe
Am 10.10.18 um 14:26 schrieb Lev Stipakov: > From: Lev Stipakov > > In Visual Studio when unary minus is applied to unsigned, > result is still unsigned. This means that when we use result > as function formal parameter, we pass incorrect value. > > Fix by introducing frame_remove_from_extra_fra