> > -   for (i = 0; i < MCP_DRV_VER_STR_SIZE - 1; i += 4) {
> > -           val = cpu_to_be32(p_ver->name[i]);
> > +   for (i = 0; i < (MCP_DRV_VER_STR_SIZE - 4) / sizeof(u32); i++) {
> > +           val = cpu_to_be32(p_ver->name[i * sizeof(u32)]);
> >             *(__be32 *)&p_drv_version->name[i * sizeof(u32)] = val;
> >     }
> 
> That change fails the 'sanity' test.
> It looks like it is copying a string that might by byteswapped into host 
> order.
> I'm guessing that the target p_drv_version->name[] is char [].
> The cpu_to_be32() call is only correct if p_ver->name[] is 32bit.
> But you are (now) indexing it with the character offset.
> So the data copied cannot be right.

Crap. Thanks for catching this up; I'll send v2 shortly.

> I also suspect it should be be32_to_cpu().
Actually, the conversion is correct as-is - data is provided by driver at
host order and should be sent to management firmware as BE.

Reply via email to