kdb: Simplify management of tmpbuffer in kdb_read()