Re: [PATCH v2] cxl: Make loop variable be 'i' instead of 'j'

From: Konrad Rzeszutek Wilk
Date: Wed Mar 03 2021 - 19:03:41 EST


..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/20210226222152.48467-1-konrad.wilk@xxxxxxxxxx/T/#u