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:	Tue, 18 Aug 2015 15:38:18 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dan Streetman <ddstreet@...e.org>
Cc:	Seth Jennings <sjennings@...iantweb.net>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
	kbuild test robot <fengguang.wu@...el.com>
Subject: Re: [PATCH 1/2] zpool: define and use max type length

On Tue, 18 Aug 2015 16:06:00 -0400 Dan Streetman <ddstreet@...e.org> wrote:

> Add ZPOOL_MAX_TYPE_NAME define, and change zpool_driver *type field to
> type[ZPOOL_MAX_TYPE_NAME].  Remove redundant type field from struct zpool
> and use zpool->driver->type instead.
> 
> The define will be used by zswap for its zpool param type name length.
> 

Patchset is fugly.  All this putzing around with fixed-length strings,
worrying about overflow and is-it-null-terminated-or-isnt-it.  Shudder.

It's much better to use variable-length strings everywhere.  We're not
operating in contexts which can't use kmalloc, we're not
performance-intensive and these strings aren't being written to
fixed-size fields on disk or anything.  Why do we need any fixed-length
strings?

IOW, why not just replace that alloca with a kstrdup()?

> --- a/include/linux/zpool.h
> +++ b/include/linux/zpool.h
>
> ...
>
> @@ -79,7 +77,7 @@ static struct zpool_driver *zpool_get_driver(char *type)
>  
>  	spin_lock(&drivers_lock);
>  	list_for_each_entry(driver, &drivers_head, list) {
> -		if (!strcmp(driver->type, type)) {
> +		if (!strncmp(driver->type, type, ZPOOL_MAX_TYPE_NAME)) {

Why strncmp?  Please tell me these strings are always null-terminated.


--
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