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] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1108150934590.24941@router.home>
Date:	Mon, 15 Aug 2011 09:38:40 -0500 (CDT)
From:	Christoph Lameter <cl@...ux.com>
To:	Iliyan Malchev <malchev@...gle.com>
cc:	Pekka Enberg <penberg@...nel.org>, Matt Mackall <mpm@...enic.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] slub: name kmalloc slabs at creation time

On Mon, 8 Aug 2011, Iliyan Malchev wrote:

> This patch reserves a small static array to hold the names of the kmalloc
> slabs, and uses a small helper function __uitoa (unsigned integer to ascii) to
> format names as appropriately

simple_strtoull etc is not satisfactory?

> +/* Convert a positive integer to its decimal string representation, starting at
> + * the end of the buffer and going backwards, not exceeding maxlen characters.
> + */
> +static __init char *__pos_int_to_string(unsigned int value, char* string,
> +					int maxindex, int maxlen)
> +{
> +	int i = maxindex - 1;
> +	string[maxindex] = 0;
> +	for (; value && i && maxlen; i--, maxlen--, value /= 10)
> +		string[i] = '0' + (value % 10);
> +	return string + i + 1;
> +}

Please use the standard string operations of the kernel.

> @@ -3652,8 +3671,15 @@ void __init kmem_cache_init(void)
>  		caches++;
>  	}
>
> +	name_start = kmalloc_cache_names;
>  	for (i = KMALLOC_SHIFT_LOW; i < SLUB_PAGE_SHIFT; i++) {
> -		kmalloc_caches[i] = create_kmalloc_cache("kmalloc", 1 << i, 0);
> +		char *name = __pos_int_to_string(1 << i, name_start,
> +					KMALLOC_NAME_MAX - 1,
> +					KMALLOC_NAME_SUFFIX_MAX);
> +		name -= 8;

8 is what? The length of "kmalloc-" right?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ