提交 1b27d7a1 编写于 作者: J Jes Sorensen 提交者: Blue Swirl

hw/ivshmem.c don't check for negative values on unsigned data types

There is no need to check for dest < 0 or vector >= 0 as both are
uint16_t.

This should fix problems with broken build with aggressive compiler
flags. Reported by Xudong Hao <xudong.hao@intel.com>
Signed-off-by: NJes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: NCam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 37a05af0
......@@ -199,13 +199,13 @@ static void ivshmem_io_writel(void *opaque, target_phys_addr_t addr,
case DOORBELL:
/* check that dest VM ID is reasonable */
if ((dest < 0) || (dest > s->max_peer)) {
if (dest > s->max_peer) {
IVSHMEM_DPRINTF("Invalid destination VM ID (%d)\n", dest);
break;
}
/* check doorbell range */
if ((vector >= 0) && (vector < s->peers[dest].nb_eventfds)) {
if (vector < s->peers[dest].nb_eventfds) {
IVSHMEM_DPRINTF("Writing %" PRId64 " to VM %d on vector %d\n",
write_one, dest, vector);
if (write(s->peers[dest].eventfds[vector],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册