[linux-lvm] [PATCH] gcc: change zero-sized array to fexlible array

Zdenek Kabelac zkabelac at redhat.com
Fri Aug 28 19:32:44 UTC 2020


Dne 26. 08. 20 v 7:18 heming.zhao at suse.com napsal(a):
> ping.
> 
> @Marian & other maintainers
> 
> 
> On 8/21/20 12:05 AM, Zhao Heming wrote:
>> this patch makes gcc happy with compiling option: [-Wstringop-overflow=]
>>
>> Signed-off-by: Zhao Heming <heming.zhao at suse.com>
>> ---
>>    device_mapper/libdm-common.c | 2 +-
>>    lib/activate/fs.c            | 2 +-
>>    libdm/libdm-common.c         | 2 +-
>>    3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/device_mapper/libdm-common.c b/device_mapper/libdm-common.c
>> index bc691d6..3627457 100644
>> --- a/device_mapper/libdm-common.c
>> +++ b/device_mapper/libdm-common.c
>> @@ -1445,7 +1445,7 @@ struct node_op_parms {
>>    	char *old_name;
>>    	int warn_if_udev_failed;
>>    	unsigned rely_on_udev;
>> -	char names[0];
>> +	char names[];
>>    };
>>    


Hi

Here I don't see much problem with patch itself - except it seems to be 
somewhat mysterious. Lvm2 is not strict ISO C compilable - there are far to 
many other things which would need to be fixed - thus flexible arrays 
shouldn't be an issue.

I'm curious why these 3 were important in your case - while other 26 
appearances passed for you just fine (see attachment).

So can you paste what sort of gcc problem do you actually try to solve ?

Regards

Zdenek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-change-zero-sized-array-to-fexlible-array-II.patch
Type: text/x-patch
Size: 8301 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20200828/b314b145/attachment.bin>


More information about the linux-lvm mailing list