usb: fix for unconfigured usb devices

Avoids null pointer in usb raw.
This commit is contained in:
Alexander Boettcher 2016-08-16 11:38:32 +02:00 committed by Christian Helmuth
parent c72d1655f4
commit d409b0e98b

View File

@ -635,7 +635,11 @@ class Usb::Session_component : public Session_rpc_object,
Config_descriptor *config_descr) override Config_descriptor *config_descr) override
{ {
Genode::memcpy(device_descr, &_device->udev->descriptor, sizeof(usb_device_descriptor)); Genode::memcpy(device_descr, &_device->udev->descriptor, sizeof(usb_device_descriptor));
if (_device->udev->actconfig)
Genode::memcpy(config_descr, &_device->udev->actconfig->desc, sizeof(usb_config_descriptor)); Genode::memcpy(config_descr, &_device->udev->actconfig->desc, sizeof(usb_config_descriptor));
else
Genode::memset(config_descr, 0, sizeof(usb_config_descriptor));
device_descr->bus = _device->udev->bus->busnum; device_descr->bus = _device->udev->bus->busnum;
device_descr->num = _device->udev->devnum; device_descr->num = _device->udev->devnum;