Linux virtualization list
 help / color / mirror / Atom feed
* Re: [PATCH v3 01/11] driver: platform: Add helper for safer setting of driver_override
       [not found] <20220227135214.145599-2-krzysztof.kozlowski@canonical.com>
@ 2022-02-28 20:03 ` Bjorn Helgaas
  0 siblings, 0 replies; only message in thread
From: Bjorn Helgaas @ 2022-02-28 20:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-hyperv, Stuart Yoder, Rafael J. Wysocki, linux-pci,
	linux-remoteproc, alsa-devel, Bjorn Andersson,
	Srinivas Kandagatla, Vineeth Vijayan, Alexander Gordeev,
	Fabio Estevam, linux-clk, linux-s390, Wei Liu, Stephen Hemminger,
	Abel Vesa, Michael S. Tsirkin, Dexuan Cui, Linus Torvalds,
	Andy Gross, NXP Linux Team, Heiko Carstens, Vasily Gorbik,
	linux-arm-msm, Sascha Hauer, linux-spi, Mark Brown,
	Rasmus Villemoes, Bjorn Helgaas, virtualization, linux-arm-kernel,
	Laurentiu Tudor, Mathieu Poirier, Greg Kroah-Hartman,
	Haiyang Zhang, Peter Oberparleiter, linux-kernel, Sven Schnelle,
	Shawn Guo

On Sun, Feb 27, 2022 at 02:52:04PM +0100, Krzysztof Kozlowski wrote:
> Several core drivers and buses expect that driver_override is a
> dynamically allocated memory thus later they can kfree() it.

> +int driver_set_override(struct device *dev, const char **override,
> +			const char *s, size_t len)
> +{
> +	const char *new, *old;
> +	char *cp;
> +
> +	if (!dev || !override || !s)
> +		return -EINVAL;
> +
> +	/* We need to keep extra room for a newline */

It would help a lot to extend this comment with a hint about where the
room for a newline is needed.  It was confusing even before, but it's
much more so now that the check is in a completely different file than
the "show" functions that need the space.

> +	if (len >= (PAGE_SIZE - 1))
> +		return -EINVAL;
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-28 20:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220227135214.145599-2-krzysztof.kozlowski@canonical.com>
2022-02-28 20:03 ` [PATCH v3 01/11] driver: platform: Add helper for safer setting of driver_override Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox