Re: [PATCH 1/3] rteval: systopology: Fix offline NUMA node parsing

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

 




On Tue, 19 Apr 2022, Valentin Schneider wrote:

> An offline NUMA node will report in its cpulist an empty
> string. Unfortunately, "".split(sep=x) with x != None returns a list
> containing an empty string rather than an empty list, which causes
> CpuList._expand_cpulist() to try to run int(''), which ends up in the
> following exception:
> 
>   ValueError: invalid literal for int() with base 10: ''
> 
> Prevent this by adding an early empty-string check.
> 
> Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
> ---
>  rteval/systopology.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/rteval/systopology.py b/rteval/systopology.py
> index bf794ce..b2da7bb 100644
> --- a/rteval/systopology.py
> +++ b/rteval/systopology.py
> @@ -103,6 +103,10 @@ class CpuList:
>          don't error check against online cpus
>          """
>          result = []
> +
> +        if not cpulist:
> +            return result
> +
>          for part in cpulist.split(','):
>              if '-' in part:
>                  a, b = part.split('-')
> -- 
> 2.27.0
> 
> 
Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux