Re: [PATCH] mmc: block: Add new ioctl to send multi commands

From: Grant Grundler
Date: Thu Sep 10 2015 - 13:11:00 EST


On Thu, Sep 10, 2015 at 1:24 AM, Jon Hunter <jonathanh@xxxxxxxxxx> wrote:
...
>> - you have some implicit padding after the structure and should replace that
>> with explictit pad bytes to extend the structure to a multiple of its
>> alignment (8 bytes).
>
> Would padding with __u32 at the end be sufficient here? I assume the
> __u32 would be 32-bit aligned. However, was not sure if this would
> always be the case.

Is there something wrong with implicit padding?
Only one copy of the structure is passed to the kernel for any given call.

>>>> struct mmc_ioc_multi_cmd {
>>>> __u64 num_of_cmds;
>>>> struct mmc_ioc_cmd cmds[0];
>>>> };

I think this would work just as well. But doesn't "pointer to an
array" require 32-bit ioctl compat handling?
We were trying to avoid a 32-bit user space compatibility handler.

>>>> as I said, both are ugly. My first choice would have been the other one,
>>>> but I'm sure you have some reasons yourself.

Why do you prefer the alternative you proposed?

My guess is better type checking (and I would like that too). But
maybe there is something else?

cheers,
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/