lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Dec 2016 09:09:24 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc:     "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        Tejun Heo <tj@...nel.org>,
        Baolin Wang <baolin.wang@...aro.org>,
        Bojan Prtvar <prtvar.b@...il.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Russell King <rmk+kernel@....linux.org.uk>,
        Pratibhasagar V <pratibha@...eaurora.org>,
        Gwendal Grignou <gwendal@...omium.org>,
        Jens Axboe <axboe@...com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Jaehoon Chung <jh80.chung@...sung.com>,
        Dong Aisheng <aisheng.dong@....com>,
        Chaotian Jing <chaotian.jing@...iatek.com>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Shawn Lin <shawn.lin@...k-chips.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Bhaktipriya Shridhar <bhaktipriya96@...il.com>,
        Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH] mmc: use empty initializer list to zero-clear structures

On Mon, Dec 19, 2016 at 12:51 PM, Masahiro Yamada
<yamada.masahiro@...ionext.com> wrote:

> In the MMC subsystem, we see such initializers that only clears the
> first member explicitly.
>
> For example,
>
>   struct mmc_request mrq = {NULL};
>
> sets the first member (.sbc) to NULL explicitly.  However, this is
> an unstable form because we may insert a non-pointer member at the
> top of the struct mmc_request in the future. (if we do so, the
> compiler will spit warnings.)
>
> So, using a designated initializer is preferred coding style.  The
> expression above is equivalent to:
>
>   struct mmc_request mrq = { .sbc = NULL };
>
> Of course, this does not express our intention.  We want to fill
> all struct members with zeros.  Please note struct members are
> implicitly zero-cleared unless otherwise specified in the initializer.
>
> After all, the most reasonable (and stable) form is:
>
>   struct mmc_request mrq = {};
>
> Do likewise for mmc_command, mmc_data as well.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>

Reviewed-by: Linus Walleij <linus.walleij@...aro.org>

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ