Commit Graph

127 Commits

Author SHA1 Message Date
Peter Jones f725fa7cb2 calloc: Use calloc() at most places
This modifies most of the places we do some form of:

  X = malloc(Y * Z);

to use calloc(Y, Z) instead.

Among other issues, this fixes:
  - allocation of integer overflow in grub_png_decode_image_header()
    reported by Chris Coulson,
  - allocation of integer overflow in luks_recover_key()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_lvm_detect()
    reported by Chris Coulson.

Fixes: CVE-2020-14308

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vladimir Serbinenko 284afab081 ehci: Fix compilation on i386 2017-07-09 21:31:19 +02:00
phcoder edb37fb30b ehci: Fix compilation for amd64 2017-07-09 20:58:31 +02:00
Vladimir Serbinenko b0b1b81a11 rk3288_spi: Add SPI driver 2017-05-09 08:44:23 +02:00
Vladimir Serbinenko c4313c812d fdtbus: Add ability to send/receive messages on parent busses. 2017-05-09 08:43:20 +02:00
Vladimir Serbinenko 4f8471532d Fix bug on FDT nodes with compatible property 2017-05-09 08:43:09 +02:00
Vladimir Serbinenko d11ced1e1f arm_coreboot: Support EHCI. 2017-05-08 22:15:05 +02:00
Vladimir Serbinenko 058df7b5a9 ehci: Split core code from PCI part.
On ARM often EHCI is present without PCI and just declared in device
tree. So splitcore from PCI part.
2017-05-08 22:10:26 +02:00
Vladimir Serbinenko fcbb723d4b Add support for device-tree-based drivers. 2017-05-08 21:19:59 +02:00
Vladimir Serbinenko ca028db3d4 usbtrans: Fix memory coherence and use-after-free. 2016-02-27 13:40:52 +01:00
Vladimir Serbinenko 0f076d75d0 ehci: Fix memory coherence
This is a no-op on x86 but necessarry on ARM and may be necessarry on MIPS.
2016-02-27 13:40:52 +01:00
Vladimir Serbinenko 054d1325e9 Improve EHCI logging
Add dprintf's on common error paths and remove some entries which are too
noisy.
2016-02-22 20:07:10 +01:00
Colin Watson 95440b41d3 ahci, ehci: Fix typos 2016-01-16 20:37:15 +00:00
Andrei Borzenkov 47490ada3d ohci: fix memory leak
Found by: Coverity scan.
CID: 96679
2015-06-20 23:38:19 +03:00
Andrei Borzenkov cf0b0306d8 usb: fix use after free
Found by: Coverity scan.
CID: 96704
2015-06-20 23:38:18 +03:00
Andrei Borzenkov 5082ea6184 remove extra newlines in grub_util_* strings
grub_util_{info,warn,error} already add trailing newlines, so remove
them from format strings. Also trailing full stops are already added.
2015-05-13 09:47:17 +03:00
Vladimir Serbinenko 27d1a67f8a Fix canonicalize_file_name clash.
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Vladimir Serbinenko 9d25b0da9a Remove emu libusb support.
It's disabled by default and has been broken for a long time.
As nobody is interested in fixing and maintaining it, remove it.
2015-03-03 20:59:36 +01:00
Vladimir Serbinenko 9ff9d5a54e uhci: Fix null pointer dereference.
Found by: Coverity scan.
2015-01-24 20:38:12 +01:00
Vladimir Serbinenko 30e177a05b grub-core/fs/minix.c (grub_minix_read_file): Avoid reading past the end of file. 2015-01-21 17:42:06 +01:00
Andrey Borzenkov 954fe77163 cleanup: grub_cpu_to_XXX_compile_time for constants
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Aleš Nesrsta e3ef0d30cf * grub-core/bus/usb/ehci.c: Fix handling of newborn transfers.
Avoid confusing them with already completed transfers.
2013-12-18 18:59:49 +01:00
Vladimir Serbinenko fd4650a556 Add bonito 3A support. 2013-12-17 22:49:27 +01:00
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir Serbinenko 1e4b358720 Add PCI command activation to all PCI drivers as required for coreboot
and maybe some other firmwares.
2013-11-26 14:21:11 +01:00
Vladimir Serbinenko 6f1bc8bc0f On i386-ieee1275 we run in paged mode. So we need to explicitly map
the devices before accessing them.
2013-11-18 04:32:33 +01:00
Vladimir Serbinenko 9f8acdaa5d * grub-core/term/serial.c: Add option for enabling/disabling
RTS/CTS flow control.
2013-11-08 18:20:20 +01:00
Vladimir Serbinenko 3f63b4d89f * grub-core/bus/usb/ehci.c (grub_ehci_restore_hw): Return right enum
type.
	(grub_ehci_fini_hw): Likewise.
	* grub-core/bus/usb/usbhub.c (grub_usb_add_hub): Likewise.
2013-11-07 00:45:15 +01:00
Vladimir Serbinenko dac6ce73be * include/grub/usb.h (grub_usb_controller_dev): Make portstatus
return grub_usb_err_t for cosistency. All users updated.
2013-11-07 00:35:56 +01:00
starous@volny.cz 7c680e1f17 USB EHCI: SMI disabled in all cases 2013-09-23 20:30:52 +02:00
Melki Christian d755342abe * grub-core/bus/usb/usbhub.c (poll_nonroot_hub): Fix the type of
"changed".
2013-09-23 14:39:13 +02:00
starous@volny.cz 306950e137 USB EHCI QH handling patch 2013-09-21 15:39:51 +02:00
Melki Christian 897c3bc634 * grub-core/bus/usb/usb.c (grub_usb_device_initialize): Add condition
to break endless loop.
2013-09-18 13:27:05 +02:00
Vladimir 'phcoder' Serbinenko efa8640adb * grub-core/bus/usb/usbhub.c: Fix recheck logic. 2013-07-11 14:52:46 +02:00
Vladimir 'phcoder' Serbinenko 96f33fed86 Make PCI init in i386-qemu port more robust. 2013-04-29 15:09:39 +02:00
Vladimir 'phcoder' Serbinenko e2f27a8c53 Enforce disabling of firmware disk drivers when native drivers kick in. 2013-04-29 12:16:46 +02:00
Vladimir 'phcoder' Serbinenko f7bf6c31f3 * grub-core/bus/usb/uhci.c: Fix DMA handling and enable on all PCI
platforms.
2013-04-29 12:05:19 +02:00
Vladimir 'phcoder' Serbinenko d70dbab77a * grub-core/bus/usb/ehci.c (grub_ehci_fini_hw): Ignore errors, not
much we can do about it anyway.
2013-04-12 20:51:11 +02:00
Aleš Nesrsta 51a4c3e3b0 Fix handling of split transfers. 2013-04-12 20:42:46 +02:00
Vladimir 'phcoder' Serbinenko 2cd5ce6cdb * grub-core/bus/usb/usbtrans.c (grub_usb_bulk_readwrite_packetize):
Init err.
2013-04-04 08:56:45 +02:00
Vladimir 'phcoder' Serbinenko 8fe05def12 Slight improve in USB-related boot-time checkpoints. 2013-03-20 17:21:13 +01:00
Vladimir 'phcoder' Serbinenko ef8810e9f3 Fix a conflict between ports structures with 2 controllers of
same kind.
2013-03-20 17:07:08 +01:00
Vladimir 'phcoder' Serbinenko f6df57d216 Initialize USB ports in parallel to speed-up boot. 2013-03-19 23:06:44 +01:00
Vladimir 'phcoder' Serbinenko d745dda77e Fix USB devices not being detected when requested
due to delayed attach.
2013-03-19 20:35:21 +01:00
Vladimir 'phcoder' Serbinenko e744219bb6 Implement boot time analysis framework. 2013-03-19 20:25:09 +01:00
Vladimir 'phcoder' Serbinenko e5a2dd7b55 remove get_endpoint_descriptor and change all functions needing
descriptor to just receive it as argument rather than endpoint
	address.
2013-03-19 11:19:36 +01:00
Vladimir 'phcoder' Serbinenko 5dd6f58789 Better estimate the maximum USB transfer size. 2013-03-19 08:17:51 +01:00
Vladimir 'phcoder' Serbinenko 66a93674b2 Implement USBDebug (full USB stack variant). 2013-02-01 21:49:29 +01:00
Vladimir 'phcoder' Serbinenko cfe1288b8d * grub-core/bus/usb/usb.c (grub_usb_device_attach): Add missing
grub_print_error.
2013-02-01 21:43:49 +01:00
Vladimir 'phcoder' Serbinenko e42b99698c * grub-core/bus/usb/serial/common.c (grub_usbserial_attach): Fix missing
zero-out of port structure.
2013-02-01 21:32:17 +01:00