summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2015-04-03 19:35:48 +0000
committermiod <miod@openbsd.org>2015-04-03 19:35:48 +0000
commitfad34e452ca305b4010c6196d07f138731784b86 (patch)
tree0cce34d9d56f77fb3b66f872498b08a6b417541d
parentEleminate the last occurrences of backticks and replace constructs (diff)
downloadwireguard-openbsd-fad34e452ca305b4010c6196d07f138731784b86.tar.xz
wireguard-openbsd-fad34e452ca305b4010c6196d07f138731784b86.zip
Fix unsigned vs signed comparison in for() loop condition causing an infinite
loop for WSDISPLAYIO_PUTCMAP ioctl with idx == 0; reported by Artem Falcon. [according to my investigation, none of the other for() loops in the kernel are affected by a similar issue]
-rw-r--r--sys/dev/ic/sti.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index 36447c2f344..58e94f7e55f 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.74 2014/11/16 12:31:00 deraadt Exp $ */
+/* $OpenBSD: sti.c,v 1.75 2015/04/03 19:35:48 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -1041,7 +1041,7 @@ sti_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
break;
if ((ret = copyin(cmapp->blue, &scr->scr_bcmap[idx], count)))
break;
- for (i = idx + count - 1; i >= idx; i--)
+ for (i = idx + count - 1; i >= (int)idx; i--)
if ((ret = sti_setcment(scr, i, scr->scr_rcmap[i],
scr->scr_gcmap[i], scr->scr_bcmap[i]))) {
#ifdef STIDEBUG