[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] xen/arm: fix unitialized use warning


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Sun, 16 Apr 2023 22:08:56 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mt+pcXhEBYCYbjFfwCuuM/w86R2K52bxIB0y1/nzKsI=; b=UyGjzJWszHnwpngIrdzeVQXMfv3PrmxIyZp8XCJSAI11UNZ3gC829Obj067werdtTzxPVKCB6AUovMRnOIHRUVGnl3vGG4Y1un4LTpGWU893QDzCWbEdzGUxYc4Aj7plazF93wog+FokF75RpfzYLW4VnVFjHiEgBTbGyfVFQFdDgJqGhbLAb/VbDCYbvHqjmAwVU9NqdffaAfvUhyuU+znn8ZjNSBLtqfGOScDfb+pFEsh3R0bFb6c0wbTBzrmQM5tcywJfk2x9kE8kz+rz4dfdNS/Wfpib/xW3HvtVLPHlrY5lmE3WPmutiq5Epk9Gl5MsWKa3Qa1OnfCtGpBWeQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcsjSlD7LX4uFfsrzEa5N+uB3KTNt3QpX+FAiI6i9VRRS7xEwD7XC8iA7tbhNXD4bGh9WRTV+VMSsbsBAOxlR6veUym71oUYFtMPoG8Qdc7NTeTu14FeqzX+sah3qe55uh+cgUKod3E0JhMsZq9h1zzz4d8EjmechdtORHiYSWtYjl8+EVI+ro3zLdHBNYhz3XZ6v+MNjJj5Sq1JZDPITygo6gBVjeMkIitDTU5ie5QwZg9rZEnp08xv7ajO+y7Iub/OBCYo+bEtU8935AyXCT5r+ApLRBXDJuriAGCjGeCq4Zh6d3h0CXhT2QdEHrgxHLJkE4/eGjHY3N7CIXOqCg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 17 Apr 2023 02:09:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 4/16/23 22:03, Stewart Hildebrand wrote:
> On 4/16/23 08:53, Julien Grall wrote:
>> Hi Stewart,
> 
> Hi Julien,
> 
>> On 14/04/2023 19:57, Stewart Hildebrand wrote:
>>> When building the hypervisor with -Og, we encounter the following error:
>>
>> Is this with GCC 12 as well?
> 
> Yes. If my memory serves me correctly this particular one occurs with both 
> GCC 11 and 12.
> 
>>> arch/arm/domain_build.c: In function ‘make_cpus_node’:
>>> arch/arm/domain_build.c:2040:12: error: ‘clock_valid’ may be used 
>>> uninitialized [-Werror=maybe-uninitialized]
>>>   2040 |         if ( clock_valid )
>>>        |            ^
>>> arch/arm/domain_build.c:1947:10: note: ‘clock_valid’ was declared here
>>>   1947 |     bool clock_valid;
>>>        |          ^~~~~~~~~~~
>>> cc1: all warnings being treated as errors
>>>
>>> Fix it by initializing the variable.
>>>
>>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
>>> ---
>>> See previous discussion here
>>> https://lists.xenproject.org/archives/html/xen-devel/2022-10/msg00741.html
>>> ---
>>>   xen/arch/arm/domain_build.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>>> index 4f9d4f9d8867..18b350734a8e 100644
>>> --- a/xen/arch/arm/domain_build.c
>>> +++ b/xen/arch/arm/domain_build.c
>>> @@ -1944,7 +1944,7 @@ static int __init make_cpus_node(const struct domain 
>>> *d, void *fdt)
>>>       /* Placeholder for cpu@ + a 32-bit hexadecimal number + \0 */
>>>       char buf[13];
>>>       u32 clock_frequency;
>>> -    bool clock_valid;
>>> +    bool clock_valid = false;
>>
>> NIT: I would add "Keep the compiler happy with -Og"
>>
>> I am happy to add it while committing if you agree.
> 
> Yes, please do. Thanks.

One more thing, there is a typo in the subject, if you are willing to correct 
it while committing. s/unitialized/uninitialized/

>> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
>>
>> Cheers,
>>
>> --
>> Julien Grall
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.