Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218774

Re: [PATCH] clk_register_clkdev: remove format string interface

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] clk_register_clkdev: remove format string interface
Date 2015-09-04 11:00 +0200
Message-ID <q4V0L-5zg-25@gated-at.bofh.it> (permalink)
References <q4JLY-6kV-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Sep 03, 2015 at 01:54:07PM -0700, Kees Cook wrote:
> Many callers either use NULL or const strings for the third argument of
> clk_register_clkdev. For those that do not and use a non-const string,
> this is a risk for format strings being accidentally processed (for
> example in device names). As this interface is already used as if it
> weren't a format string (prints nothing when NULL), and there are zero
> users of the format strings, remove the format string interface to make
> sure format strings will not leak into the clkdev.
> 
> $ git grep '\bclk_register_clkdev\b' | grep % | wc -l
> 0
> 
> Unfortunately, all the internals expect a va_list even though they treat
> a NULL format string as special. To deal with this, we must pass either
> (..., "%s", string) or (..., NULL, NULL) so that a the va_list will be
> created correctly (passing the name as an argument, not a format string).

A more clearer way to write that would be:

	if (dev_id)
		cl = clkdev_create(hw, con_id, "%s", dev_id);
	else
		cl = clkdev_create(hw, con_id, NULL);

then it's obvious what's going on.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] clk_register_clkdev: remove format string interface Kees Cook <keescook@chromium.org> - 2015-09-03 23:00 +0200
  Re: [PATCH] clk_register_clkdev: remove format string interface Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-04 11:00 +0200

csiph-web