linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: krzk@kernel.org (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] pinctrl: samsung: Handle memory allocation failure during wakeup banks init
Date: Tue, 23 May 2017 20:41:40 +0200	[thread overview]
Message-ID: <20170523184141.24284-2-krzk@kernel.org> (raw)
In-Reply-To: <20170523184141.24284-1-krzk@kernel.org>

Check if kmemdup failed during wakeup banks initialization.  Otherwise
NULL pointer would be stored under "irq_chip" member of bank and later
dereferenced in interrupt handler.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/pinctrl/samsung/pinctrl-exynos.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
index cdea07af308a..66122627b3ed 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -503,6 +503,8 @@ static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
 		if (match) {
 			irq_chip = kmemdup(match->data,
 				sizeof(*irq_chip), GFP_KERNEL);
+			if (!irq_chip)
+				return -ENOMEM;
 			wkup_np = np;
 			break;
 		}
-- 
2.9.3

  reply	other threads:[~2017-05-23 18:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 18:41 [PATCH 1/3] pinctrl: samsung: Constify wakeup driver specific data Krzysztof Kozlowski
2017-05-23 18:41 ` Krzysztof Kozlowski [this message]
2017-05-23 18:41 ` [PATCH 3/3] pinctrl: samsung: Explicitly cast pointer returned by of_iomap() to iomem Krzysztof Kozlowski
2017-05-29  9:34 ` [PATCH 1/3] pinctrl: samsung: Constify wakeup driver specific data Linus Walleij

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=20170523184141.24284-2-krzk@kernel.org \
    --to=krzk@kernel.org \
    --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 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).