mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	julia.lawall@lip6.fr, michael.leibowitz@intel.com,
	keescook@chromium.org
Subject: Re: [PATCH] hfs: Change structure initialisation to C99 style
Date: Wed, 22 Jun 2016 10:32:16 -0700	[thread overview]
Message-ID: <1466616736.2671.1.camel@slavad-ubuntu-14.04> (raw)
In-Reply-To: <20160622053420.GA9024@amitoj-Inspiron-3542>

On Wed, 2016-06-22 at 11:04 +0530, Amitoj Kaur Chawla wrote:
> 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:
> 

Looks reasonable.

Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>

Thanks,
Vyacheslav Dubeyko.


> @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 <amitoj1606@gmail.com>
> ---
>  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);

      reply	other threads:[~2016-06-22 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  5:34 Amitoj Kaur Chawla
2016-06-22 17:32 ` Viacheslav Dubeyko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466616736.2671.1.camel@slavad-ubuntu-14.04 \
    --to=slava@dubeyko.com \
    --cc=amitoj1606@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.leibowitz@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®