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

Re: [PATCH 09/10] dom0less: Reinitialise all variables on each loop iteration


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Tue, 22 Jul 2025 14:37:08 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com 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 (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=sGphgP6EftAW0QnFRnRRBUPbyvdDi+ylBw9k5Tc8njo=; b=diBYYZyEtsm6uf//CcuKLRvSjiwliWgRY0LJzWi2hIFcAv3V4xNQ5LRUEQIFLZpkhphY+BxFp5DqBSYDF4JC35AMAnTSNeKnqbAd8fjFqThr4djb6QVUnJ8j83QAtfhGhBRZsvVk4yjJaiUDJ8fMMNNs7vnefWQTsL5b2SbDgOBYckdNqu+98vUaoESeKeoeQbna9raUuAHCr/R4n3P8f4ZUPodBPSS2/fzycO5QdXTmqU0LisSP/o3FuavFVfkJYfP2MZGgofnjKAGzH2YdhmAAnKT1TlZGkQBHi2jilGvxOZJkDiui9o6MiSddA/Ui0vzSLn2QpYRi+PmW0r+o/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=diHoktTLe5momw1y3ciRU7/rpNWUgm4jecwzsik6Oyjbp8JkvicXsVtExEd2g2gBCTq76sfpcY/jgPQYVvtToMjAeImCzJXBpikMDPdMyANb3s5RxWFVGhA2B7hKoWJHaipxnZJPThJ3vR2VilgdpdhqT6eHwP0Id4HCz/aozxJnb8RhvG0RdTHakN0r0DbmPxYfpbhWvlFQCSCs4HIHlqmopB1y778ffyAL/uPBTBzDNLnOzTRHxIQGuG5A4LM9qSMbTIr41MxlfKVn5JwK0nk4T3UNYDNEn8An80QAedx/U7k8klroRlqYJ4D54e791ocZj01+GEJExUwwr2EaxQ==
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 22 Jul 2025 12:37:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue Jul 22, 2025 at 2:18 PM CEST, Jan Beulich wrote:
> On 22.07.2025 13:59, Alejandro Vallejo wrote:
>> Reduce the scope of every variable so they are reinitialised. "iommu",
>> for instance, isn't being cleared, so the wrong flags may make it to
>> domains that should not have them.
>
> Yet "for instance" isn't quite right, is it? "iommu" is the only one where
> the (re)init was misplaced. The other two ...

We do strive for minimal scope where possible. But you're right "for instance"
might be misleading in suggesting there's more bugs than one.

I'm happy to have "for instance" removed, leaving the rest as-is, if that works
for you.

>
>> --- a/xen/common/device-tree/dom0less-build.c
>> +++ b/xen/common/device-tree/dom0less-build.c
>> @@ -826,14 +826,14 @@ static int __init construct_domU(struct kernel_info 
>> *kinfo,
>>  void __init create_domUs(void)
>>  {
>>      struct dt_device_node *node;
>> -    const char *dom0less_iommu;
>> -    bool iommu = false;
>> -    const struct dt_device_node *cpupool_node,
>> -                                *chosen = dt_find_node_by_path("/chosen");
>> +    const struct dt_device_node *chosen = dt_find_node_by_path("/chosen");
>>  
>>      BUG_ON(chosen == NULL);
>>      dt_for_each_child_node(chosen, node)
>>      {
>> +        const char *dom0less_iommu;
>> +        bool iommu = false;
>> +        const struct dt_device_node *cpupool_node;
>
> ... had no initializer, and also don't gain any. So they must both be
> set inside the loop. (Irrespective, the scope reduction is a good thing
> imo.)
>
> Jan

Cheers,
Alejandro



 


Rackspace

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