Use readstr() for #device text buffers
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 28 Sep 2018 20:12:06 +0000 (16:12 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 2 Oct 2018 18:07:01 +0000 (14:07 -0400)
commit9da15ac915cd090920816fdd62e801d8d649b773
tree25a8d6c0851211d98cede700f140f4e57cef01ad
parent8c40c98c670084bf352d73e32c89f3f0c6b9aa7f
Use readstr() for #device text buffers

These two follow the sized_kmalloc pattern for generating buffers.  They
generate text, not raw data, and it should be readstr, not readmem.
Otherwise, we'll return extra bytes (zeros).

Note that our snprintf() (which creates the data in these cases) enforces
null-termination, so there's no concern with running off the end of the
sza.

Also note that our snprintf() returns the amount written, not the amount of
space needed, which is non-standard.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/mem.c
kern/drivers/dev/proc.c