On 11/28/20 9:59 PM, Peter Maydell wrote:
> On Fri, 27 Nov 2020 at 15:45, Philippe Mathieu-Daudé
> wrote:
>>
>> Hi,
>>
>> This is a simple attempt to avoid the following pattern:
>>
>> ssize_t pkt_size = get_pkt_size(); // returns errno
>>
>> // no check
>>
>> send_packet(size_t size=pkt_si
On Fri, 27 Nov 2020 at 15:45, Philippe Mathieu-Daudé wrote:
>
> Hi,
>
> This is a simple attempt to avoid the following pattern:
>
> ssize_t pkt_size = get_pkt_size(); // returns errno
>
> // no check
>
> send_packet(size_t size=pkt_size); // size casted to unsigned
>
On 11/27/20 4:45 PM, Philippe Mathieu-Daudé wrote:
> Hi,
>
> This is a simple attempt to avoid the following pattern:
>
> ssize_t pkt_size = get_pkt_size(); // returns errno
Sorry, I meant: returns "-errno" (< 0).
>
> // no check
>
> send_packet(size_t size=pkt_size); // size casted to
Hi,
This is a simple attempt to avoid the following pattern:
ssize_t pkt_size = get_pkt_size(); // returns errno
// no check
send_packet(size_t size=pkt_size); // size casted to unsigned
// -> overflow
Regards,
Phil.
Philippe Mathieu-Daudé (2):
ne