Skip to content

Commit

Permalink
Pull up the following revisions(s) (requested by bouyer in ticket #19…
Browse files Browse the repository at this point in the history
…65):

	sys/arch/xen/xen/xenevt.c:	revision 1.42

Fix off by one error, addresses port-xen/49919.
  • Loading branch information
sborrill committed May 22, 2015
1 parent d7de353 commit a0e36cc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sys/arch/xen/xen/xenevt.c
@@ -1,4 +1,4 @@
/* $NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $ */
/* $NetBSD: xenevt.c,v 1.29.4.2.6.1 2015/05/22 11:44:25 sborrill Exp $ */

/*
* Copyright (c) 2005 Manuel Bouyer.
Expand Down Expand Up @@ -31,7 +31,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $");
__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.29.4.2.6.1 2015/05/22 11:44:25 sborrill Exp $");

#include "opt_xen.h"
#include <sys/param.h>
Expand Down Expand Up @@ -496,7 +496,7 @@ xenevt_fwrite(struct file *fp, off_t *offp, struct uio *uio,
if (uio->uio_resid == 0)
return (0);
nentries = uio->uio_resid / sizeof(uint16_t);
if (nentries > NR_EVENT_CHANNELS)
if (nentries >= NR_EVENT_CHANNELS)
return EMSGSIZE;
chans = kmem_alloc(nentries * sizeof(uint16_t), KM_SLEEP);
if (chans == NULL)
Expand Down Expand Up @@ -580,7 +580,7 @@ xenevt_fioctl(struct file *fp, u_long cmd, void *addr)
{
struct ioctl_evtchn_unbind *unbind = addr;

if (unbind->port > NR_EVENT_CHANNELS)
if (unbind->port >= NR_EVENT_CHANNELS)
return EINVAL;
if (devevent[unbind->port] != d)
return ENOTCONN;
Expand All @@ -596,7 +596,7 @@ xenevt_fioctl(struct file *fp, u_long cmd, void *addr)
{
struct ioctl_evtchn_notify *notify = addr;

if (notify->port > NR_EVENT_CHANNELS)
if (notify->port >= NR_EVENT_CHANNELS)
return EINVAL;
if (devevent[notify->port] != d)
return ENOTCONN;
Expand Down

0 comments on commit a0e36cc

Please sign in to comment.