[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.2 0/4] Zero sockaddr_in when initializing it
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH for-6.2 0/4] Zero sockaddr_in when initializing it |
Date: |
Sun, 15 Aug 2021 18:13:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 8/15/21 5:44 PM, Peter Maydell wrote:
> On Sun, 15 Aug 2021 at 15:34, Philippe Mathieu-Daudé <philmd@redhat.com>
> wrote:
>>
>> On 8/13/21 8:30 PM, Eric Blake wrote:
>>> FWIW, the POSIX wording is interesting - it requires portable
>>> applications to zero out sockaddr_in6 (and even states that memset()
>>> is not yet a portable way to do that on exotic hardware, although a
>>> future version of POSIX may add a zero-bit constraint on
>>> implementations; in practice we only use qemu on hardware where
>>> memset() to zero properly sets pointers to NULL and floating points to
>>> 0.0).
>>
>> So this checkpatch.pl error (inherited from Linux) is against POSIX?
>>
>> 2028 # check for static initialisers.
>> 2029 if ($line =~ /\bstatic\s.*=\s*(0|NULL|false)\s*;/) {
>> 2030 ERROR("do not initialise statics to 0 or NULL\n" .
>> 2031 $herecurr);
>> 2032 }
>
> That one is for statics, where the C spec says you get 0-init by
> default and so there's no need to explicitly 0-init.
Ah OK, thanks :)