[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190123140447.GK202535@sasha-vm>
Date: Wed, 23 Jan 2019 09:04:47 -0500
From: Sasha Levin <sashal@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
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
On Wed, Jan 09, 2019 at 11:48:54AM +0300, Dan Carpenter wrote:
>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.
I'll drop it, thank you.
--
Thanks,
Sasha
Powered by blists - more mailing lists