public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>,
	Zhu Yanjun <yanjun.zhu@linux.dev>,
	Zhu Yanjun <yanjun.zhu@intel.com>,
	"haris.iqbal@ionos.com" <haris.iqbal@ionos.com>,
	"jinpu.wang@ionos.com" <jinpu.wang@ionos.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH 1/1] RDMA/rtrs: Fix the problem of variable not initialized fully
Date: Wed, 20 Sep 2023 12:34:42 -0300	[thread overview]
Message-ID: <20230920153442.GV13795@ziepe.ca> (raw)
In-Reply-To: <20230920074753.GJ4494@unreal>

On Wed, Sep 20, 2023 at 10:47:53AM +0300, Leon Romanovsky wrote:

> > >> About this problem, I think we discussed it previously in RDMA maillist.
> > >>
> > >> And at that time, IIRC, you shared a link with me. The link is as below.
> > >>
> > >> https://www.ex-parrot.com/~chris/random/initialise.html
> > >>
> > >>  From what we discussed and the above link, I think it is not initialized
> > >> fully.
> > > 
> > > I remember that discussion and it was about slightly different thing:
> > > {} vs {0} in Linux kernel.
> > 
> > 
> > Well, in my mind, I thought they are the same. see: https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Initializing-Structure-Members
> 
> It is GCC specific implementation, the original discussion was about C-standard.

Yes, the C standard says they are different constructs and
pedantically only {} is required to fully zero the struct, padding and
all.

{0} says 'zero initialize the first member of the struct', it is a
terrible construct because the first member may not be an integer,
don't use it.

Jason

  reply	other threads:[~2023-09-20 15:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19  2:08 [PATCH 1/1] RDMA/rtrs: Fix the problem of variable not initialized fully Zhu Yanjun
2023-09-19  8:17 ` Leon Romanovsky
2023-09-19  8:26   ` Zhu Yanjun
2023-09-19  9:30     ` Leon Romanovsky
2023-09-20  2:16       ` Zhijian Li (Fujitsu)
2023-09-20  5:46         ` Jinpu Wang
2023-09-20  7:47         ` Leon Romanovsky
2023-09-20 15:34           ` Jason Gunthorpe [this message]
2023-09-19  9:30 ` Leon Romanovsky

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=20230920153442.GV13795@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=haris.iqbal@ionos.com \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=yanjun.zhu@intel.com \
    --cc=yanjun.zhu@linux.dev \
    /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