All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 16:51:05 +0000	[thread overview]
Message-ID: <20140526165105.GD3693@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1401122483-31603-1-git-send-email-emilgoode@gmail.com>

On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
>  		strcpy(pa->name, name);
>  		pa->pdev.name = pa->name;
>  		pa->pdev.id = id;
> +		pa->pdev.dev.dma_mask = &pa->dma_mask;

There is code in the kernel which, rightly or wrongly, checks whether
dev->dma_mask is NULL to determine whether the device can do any kind
of DMA.  The above results in devices allocated via this interface
always having this member set, which is a change of core kernel behaviour.

How sure are you that this will not break anything?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 17:51:05 +0100	[thread overview]
Message-ID: <20140526165105.GD3693@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1401122483-31603-1-git-send-email-emilgoode@gmail.com>

On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
>  		strcpy(pa->name, name);
>  		pa->pdev.name = pa->name;
>  		pa->pdev.id = id;
> +		pa->pdev.dev.dma_mask = &pa->dma_mask;

There is code in the kernel which, rightly or wrongly, checks whether
dev->dma_mask is NULL to determine whether the device can do any kind
of DMA.  The above results in devices allocated via this interface
always having this member set, which is a change of core kernel behaviour.

How sure are you that this will not break anything?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Emil Goode <emilgoode@gmail.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Yann Droneaud" <ydroneaud@opteya.com>,
	"Shawn Guo" <shawn.guo@freescale.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Olof Johansson" <olof@lixom.net>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 17:51:05 +0100	[thread overview]
Message-ID: <20140526165105.GD3693@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1401122483-31603-1-git-send-email-emilgoode@gmail.com>

On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
>  		strcpy(pa->name, name);
>  		pa->pdev.name = pa->name;
>  		pa->pdev.id = id;
> +		pa->pdev.dev.dma_mask = &pa->dma_mask;

There is code in the kernel which, rightly or wrongly, checks whether
dev->dma_mask is NULL to determine whether the device can do any kind
of DMA.  The above results in devices allocated via this interface
always having this member set, which is a change of core kernel behaviour.

How sure are you that this will not break anything?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

  parent reply	other threads:[~2014-05-26 16:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 16:41 [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` [PATCH 2/3] driver core/platform: make .name of struct platform_object a C99 flexible array Emil Goode
2014-05-26 16:41   ` Emil Goode
2014-05-26 16:41   ` Emil Goode
2014-05-26 16:41 ` [PATCH 3/3] ARM: imx: don't allocate memory for .dma_mask of struct device Emil Goode
2014-05-26 16:41   ` Emil Goode
2014-05-26 16:41   ` Emil Goode
2014-05-26 16:51 ` Russell King - ARM Linux [this message]
2014-05-26 16:51   ` [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Russell King - ARM Linux
2014-05-26 16:51   ` Russell King - ARM Linux
2014-05-26 18:31   ` Emil Goode
2014-05-26 18:31     ` Emil Goode
2014-05-26 18:31     ` Emil Goode
2014-05-26 18:14 ` Uwe Kleine-König
2014-05-26 18:14   ` Uwe Kleine-König
2014-05-26 18:14   ` Uwe Kleine-König
2014-05-26 19:14 ` Yann Droneaud
2014-05-26 19:14   ` Yann Droneaud
2014-05-26 19:14   ` Yann Droneaud
2014-05-26 19:30 ` Dan Carpenter
2014-05-26 19:30   ` Dan Carpenter
2014-05-26 19:30   ` Dan Carpenter
2014-05-26 19:40   ` Emil Goode
2014-05-26 19:40     ` Emil Goode
2014-05-26 19:40     ` Emil Goode

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140526165105.GD3693@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.