[PATCH stable] dm ioctl: fix out of bounds array access when no devices