From patchwork Wed Jun 22 05:34:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitoj Kaur Chawla X-Patchwork-Id: 9191927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 232DB60756 for ; Wed, 22 Jun 2016 05:35:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1230B28391 for ; Wed, 22 Jun 2016 05:35:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06722283E5; Wed, 22 Jun 2016 05:35:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEFB528391 for ; Wed, 22 Jun 2016 05:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751077AbcFVFe5 (ORCPT ); Wed, 22 Jun 2016 01:34:57 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33561 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbcFVFe4 (ORCPT ); Wed, 22 Jun 2016 01:34:56 -0400 Received: by mail-pf0-f195.google.com with SMTP id c74so3150703pfb.0; Tue, 21 Jun 2016 22:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=qqOgYMbdroU+w4DIPDAqt3aQzEUxf+sqVXZRZlakd6Q=; b=s5dPI1NbkGGgL/sI3/GOBQ5ESVdrglmgyyP+OPt7rEhvVQ6UNZUzj64ut+QhE7U6X+ DMs5WaX3mu0ePsDbcUfuBaIS6AbUfdbwlCuSqZhwWRPDS8lA4foqU3wrne6reKSfzoo4 bu2kxo5XiWc/BUB2kH70kPgqUI1kFemOugryTNjJcGV7gCpCCU7u+DXF0UQfqJncg8Yq flDuwmRq3+WEf2etNm5rk/JycFN/rGMszJ0OuaDoURfDVXier5Bwjb9RtHZFOegKdO8m Z6DtPI1P/r+QXEKKTUc9UXNnCc4RhaUfcUbhCF/03iB71WYQS36LAPKW+4949peRN9Vg AKdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=qqOgYMbdroU+w4DIPDAqt3aQzEUxf+sqVXZRZlakd6Q=; b=WXMiIIOILDYHT3k0jSJnvdq4nU8fQxp7GFlkG/i45m8Ub804zjZRcjulhY4ma6aXxT FJQv9Rg+bqlk5aqRxmp2zMvRwWIOCGqJ+xlfCeIoQ0VgyfSY89a2bKQvSGrsFquMgKsD bzOAs30WlHv/ywE1L4JFXbja+oecUPkm/SpArIraiOuV5PG1pSy9YG2i71R1AEHdel2Q UMIPQ1h42ngLrZcPCpxxwXC7/aBb8Ak/14aFgNvC0UW+muhyVUbTaUQ0yktqtweA22uw HvX6sDOJUrQqohCc26Lj7k+qKzJOeAKtY6A9jV/nAcddCZDITQeI8V+QRO1TIN9/1dU/ TXRQ== X-Gm-Message-State: ALyK8tL8X7IrWAuZXXFoilw8FhHPJw7+Mvzp7ZcEL7iERgefn5e1UmSIZk9QnFfGhpedVA== X-Received: by 10.98.2.74 with SMTP id 71mr32679473pfc.49.1466573672102; Tue, 21 Jun 2016 22:34:32 -0700 (PDT) Received: from localhost ([122.176.223.219]) by smtp.gmail.com with ESMTPSA id tj10sm8814112pab.21.2016.06.21.22.34.29 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 21 Jun 2016 22:34:31 -0700 (PDT) Date: Wed, 22 Jun 2016 11:04:20 +0530 From: Amitoj Kaur Chawla To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr, michael.leibowitz@intel.com, keescook@chromium.org Subject: [PATCH] hfs: Change structure initialisation to C99 style Message-ID: <20160622053420.GA9024@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To allow for structure randomisation, replace the in order struct initialisation style with explicit field style. Also, remove an unnecessary initialisation since NULL values do not need to be explicitly initialised. The Coccinelle semantic patch used to make this change is as follows: @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @@ identifier decl.i1,i2,decl.fld; expression e; position bad.p, bad.fix; @@ struct i1 i2@p = { ..., + .fld = e - e@fix ,...}; Signed-off-by: Amitoj Kaur Chawla Reviewed-by: Vyacheslav Dubeyko --- fs/hfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index cb1e5fa..29fc0ea 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -380,7 +380,7 @@ static int hfs_read_inode(struct inode *inode, void *data) */ struct inode *hfs_iget(struct super_block *sb, struct hfs_cat_key *key, hfs_cat_rec *rec) { - struct hfs_iget_data data = { key, rec }; + struct hfs_iget_data data = { .key = key, .rec = rec }; struct inode *inode; u32 cnid; @@ -527,7 +527,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, fd.search_key->cat = HFS_I(dir)->cat_key; res = hfs_brec_read(&fd, &rec, sizeof(rec)); if (!res) { - struct hfs_iget_data idata = { NULL, &rec }; + struct hfs_iget_data idata = { .rec = &rec }; hfs_read_inode(inode, &idata); } hfs_find_exit(&fd);