diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-04-03 19:35:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-04-03 19:35:49 +0000 |
commit | ac79f314c49ed2520b8386f666da9c78f94b5626 (patch) | |
tree | 7c40a7897024db5a0e2c7eb2a42b50197a641a0c /sys/dev | |
parent | 71eb52f3573f6a2c361f24f26fcc206e97ff05cb (diff) |
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]
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/sti.c | 4 |
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 |