shithub: riscv

Download patch

ref: 062a46607e5be63440604b7f3286aa09d7826d75
parent: 9cb3e5900e916196cb13d460727a2d863627327a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Sep 28 15:25:23 EDT 2016

nusb/kb: set usage to 0 (undefined) for items exceeding usage list

--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -234,8 +234,7 @@
 					for(i=l[UsagMin]; i<=l[UsagMax] && l[UsgCnt] < Nu; i++)
 						l[Nl + l[UsgCnt]++] = i;
 				for(i=0; i<g[RepCnt]; i++){
-					if(i < l[UsgCnt])
-						l[Usage] = l[Nl + i];
+					l[Usage] = i < l[UsgCnt] ? l[Nl + i] : 0;
 					(*f)(t, v, g, l, c, a);
 				}
 				break;