[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190109084854.GA1743@kadam>
Date: Wed, 9 Jan 2019 11:48:54 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
devel@...verdev.osuosl.org, linux-media@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 4.20 056/117] media: cedrus: don't initialize
pointers with zero
This is a pure cleanup patch, it doesn't affect runtime.
On Tue, Jan 08, 2019 at 02:25:24PM -0500, Sasha Levin wrote:
> From: Mauro Carvalho Chehab <mchehab+samsung@...nel.org>
>
> [ Upstream commit e4d7b113fdccde1acf8638c5879f2a450d492303 ]
>
> A common mistake is to assume that initializing a var with:
> struct foo f = { 0 };
>
> Would initialize a zeroed struct. Actually, what this does is
> to initialize the first element of the struct to zero.
>
> According to C99 Standard 6.7.8.21:
>
> "If there are fewer initializers in a brace-enclosed
> list than there are elements or members of an aggregate,
> or fewer characters in a string literal used to initialize
> an array of known size than there are elements in the array,
> the remainder of the aggregate shall be initialized implicitly
> the same as objects that have static storage duration."
Static storage is initialized to zero so this is fine. It's just
that Sparse complains if you mix NULL and zero.
regards,
dan carpenter
Powered by blists - more mailing lists