qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* acpi_pcihp_eject_slot() bug if passed 'slots == 0'
@ 2020-03-26 11:52 Peter Maydell
  2020-03-26 12:29 ` Igor Mammedov
  2020-03-26 13:23 ` Igor Mammedov
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2020-03-26 11:52 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Igor Mammedov, Michael S. Tsirkin

Hi; Coverity spots that if hw/acpi/pcihp.c:acpi_pcihp_eject_slot()
is passed a zero 'slots' argument then ctz32(slots) will return 32,
and then the code that does '1U << slot' is C undefined behaviour
because it's an oversized shift. (This is CID 1421896.)

Since the pci_write() function in this file can call
acpi_pcihp_eject_slot() with an arbitrary value from the guest,
I think we need to handle 'slots == 0' safely. But what should
the behaviour be?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-26 13:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 11:52 acpi_pcihp_eject_slot() bug if passed 'slots == 0' Peter Maydell
2020-03-26 12:29 ` Igor Mammedov
2020-03-26 12:50   ` Igor Mammedov
2020-03-26 13:29     ` Michael S. Tsirkin
2020-03-26 13:23 ` Igor Mammedov
2020-03-26 13:28   ` Michael S. Tsirkin
2020-03-26 13:31     ` Michael S. Tsirkin
2020-03-26 13:40       ` Igor Mammedov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).