[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxc: Fix checks on grant notify arguments
# HG changeset patch # User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> # Date 1322763612 0 # Node ID cc556b4cb3bec4e6b3be3c551590ab51b25052ef # Parent 2618a5d6313d3c7defbf8f60d43d148595b934e0 libxc: Fix checks on grant notify arguments The notify offset and event channels are both unsigned variables, so testing for >= 0 will not correctly detect the use of -1 to indicate the field is unused. Remove the useless comparison and replace with correct range checks or comparisons to -1. Reported-by: Anil Madhavapeddy <anil@xxxxxxxxxx> Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r 2618a5d6313d -r cc556b4cb3be tools/libxc/xc_linux_osdep.c --- a/tools/libxc/xc_linux_osdep.c Thu Dec 01 18:15:51 2011 +0000 +++ b/tools/libxc/xc_linux_osdep.c Thu Dec 01 18:20:12 2011 +0000 @@ -566,7 +566,7 @@ struct ioctl_gntdev_unmap_notify notify; notify.index = map->index; notify.action = 0; - if (notify_offset >= 0 && notify_offset < XC_PAGE_SIZE * count) { + if (notify_offset < XC_PAGE_SIZE * count) { notify.index += notify_offset; notify.action |= UNMAP_NOTIFY_CLEAR_BYTE; } @@ -708,11 +708,11 @@ notify.index = gref_info->index; notify.action = 0; - if (notify_offset >= 0) { + if (notify_offset < XC_PAGE_SIZE * count) { notify.index += notify_offset; notify.action |= UNMAP_NOTIFY_CLEAR_BYTE; } - if (notify_port >= 0) { + if (notify_port != -1) { notify.event_channel_port = notify_port; notify.action |= UNMAP_NOTIFY_SEND_EVENT; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |