lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Dec 2023 13:56:02 -0800
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        <linux-kselftest@...r.kernel.org>, Shuah Khan <shuah@...nel.org>,
        "Shaopeng Tan" <tan.shaopeng@...fujitsu.com>,
        Maciej Wieczór-Retman 
        <maciej.wieczor-retman@...el.com>,
        Fenghua Yu <fenghua.yu@...el.com>
CC:     <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 09/29] selftests/resctrl: Create cache_portion_size()
 helper

Hi Ilpo,

On 12/11/2023 4:18 AM, Ilpo Järvinen wrote:
> +/*
> + * cache_portion_size - Calculate the size of a cache portion
> + * @cache_size:		Total cache size in bytes
> + * @portion_mask:	Cache portion mask
> + * @full_cache_mask:	Full Cache Bit Mask (CBM) for the cache
> + *
> + * Return: The size of the cache portion in bytes.
> + */
> +static inline int cache_portion_size(unsigned long cache_size,
> +				     unsigned long portion_mask,
> +				     unsigned long full_cache_mask)
> +{
> +	return cache_size * count_bits(portion_mask) / count_bits(full_cache_mask);
> +}
> +

Even after you added the new zero check the static checker I tried
was not able to recognize that this is safe. Could you please add a check
to ensure that there will be no divide-by-zero here?

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ