From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752728AbbIJSVE (ORCPT ); Thu, 10 Sep 2015 14:21:04 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19978 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbbIJSVC (ORCPT ); Thu, 10 Sep 2015 14:21:02 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 10 Sep 2015 11:16:20 -0700 Subject: Re: [PATCH] mmc: block: Add new ioctl to send multi commands To: Grant Grundler References: <1441811161-18513-1-git-send-email-jonathanh@nvidia.com> <1481090.IIYrKtDeR0@wuerfel> <55F06206.9040001@nvidia.com> <3546402.HsxrhMD6nc@wuerfel> <55F13E33.9000703@nvidia.com> CC: Arnd Bergmann , Ulf Hansson , Olof Johansson , Seshagiri Holi , "linux-mmc@vger.kernel.org" , LKML From: Jon Hunter Message-ID: <55F1CA06.3020904@nvidia.com> Date: Thu, 10 Sep 2015 19:20:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.26.11.226] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09/15 18:10, Grant Grundler wrote: > On Thu, Sep 10, 2015 at 1:24 AM, Jon Hunter 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. I think that this is fine as it is a zero length array [0] and not a pointer. Cheers Jon [0] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html