..snip..
> > cxl_for_each_cmd(cmd) {
> > const struct cxl_command_info *info = &cmd->info;
> > + int i = 0;
> >
> > - if (copy_to_user(&q->commands[j++], info, sizeof(*info)))
> > + if (copy_to_user(&q->commands[i++], info, sizeof(*info)))
> > return -EFAULT;
> >
> > - if (j == n_commands)
> > + if (i == n_commands)
> > break;
>
>
> Did you test this?
> Looks badly broken to me.I sent out the v3 which had that fixed. See https://lore.kernel.org/linux-cxl/[email protected]/T/#u

