riscv: fix use of incorrectly sized variables