perf: Fix off-by-one retval for write()
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 1 Aug 2017 15:48:32 +0000 (11:48 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 14 Aug 2017 21:02:19 +0000 (17:02 -0400)
commit147cb3c0a299f5ab1a3be5bf6e5467b7d39cb07a
tree67854cf9e8ae921ba6988797b36618b0e8ebc1a8
parente1985140c2018ff474aa089ed6782e4031fa3142
perf: Fix off-by-one retval for write()

kptr should only be advanced when we are reading the input.  We were
incrementing kptr for PERFMON_CMD_CPU_CAPS, resulting in returning '2' for
a write of '1'.

This managed to work for a while since we had another bug masking it, which
was fixed in commit 395ce5721d96 ("Fix Plan 9 partial write() return
values").

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/devarch.c