linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check
@ 2013-07-29  8:19 Sachin Kamat
  2013-07-29 12:24 ` Maxime Ripard
  2013-08-07 18:21 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Sachin Kamat @ 2013-07-29  8:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: linus.walleij, sachin.kamat, Maxime Ripard

*map should be tested for NULL instead of map as kmalloc pointer
is assigned to it. This also fixes a potential null pointer dereference
bug later in the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/pinctrl-sunxi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index c47fd1e..3655a5a 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -175,7 +175,7 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
 	}
 
 	*map = kmalloc(nmaps * sizeof(struct pinctrl_map), GFP_KERNEL);
-	if (!map)
+	if (!*map)
 		return -ENOMEM;
 
 	of_property_for_each_string(node, "allwinner,pins", prop, group) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check
  2013-07-29  8:19 [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check Sachin Kamat
@ 2013-07-29 12:24 ` Maxime Ripard
  2013-08-07 18:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2013-07-29 12:24 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, linus.walleij

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

On Mon, Jul 29, 2013 at 01:49:32PM +0530, Sachin Kamat wrote:
> *map should be tested for NULL instead of map as kmalloc pointer
> is assigned to it. This also fixes a potential null pointer dereference
> bug later in the code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check
  2013-07-29  8:19 [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check Sachin Kamat
  2013-07-29 12:24 ` Maxime Ripard
@ 2013-08-07 18:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-08-07 18:21 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel@vger.kernel.org, Maxime Ripard

On Mon, Jul 29, 2013 at 10:19 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:

> *map should be tested for NULL instead of map as kmalloc pointer
> is assigned to it. This also fixes a potential null pointer dereference
> bug later in the code.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>

Patch applied with Maxime's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-07 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29  8:19 [PATCH 1/1] pinctrl: sunxi: Fix incorrect NULL check Sachin Kamat
2013-07-29 12:24 ` Maxime Ripard
2013-08-07 18:21 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).