packet_stream: packets w/o payload are still valid

Packets whose data is stored within the Packet_descriptor itself
but not as payload, .e.g Usb::Packet_descriptor, are valid packets
after all. So loosen the packet valid check for zero-sized packets
is reasonable.

Fixes #3076.
This commit is contained in:
Josef Söntgen 2018-12-10 14:02:47 +01:00 committed by Norman Feske
parent 6b35b9de00
commit 108034b050
1 changed files with 1 additions and 1 deletions

View File

@ -538,7 +538,7 @@ class Genode::Packet_stream_base
bool packet_valid(Packet_descriptor packet)
{
return (packet.offset() >= _bulk_buffer_offset
return !packet.size() || (packet.offset() >= _bulk_buffer_offset
&& packet.offset() < _bulk_buffer_offset + (Genode::off_t)_bulk_buffer_size
&& packet.offset() + packet.size() <= _bulk_buffer_offset + _bulk_buffer_size);
}