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


Groups > linux.kernel > #1299142 > unrolled thread

[PATCH] ata: correctly handling failed allocation

Started byInsu Yun <wuninsu@gmail.com>
First post2015-12-29 22:20 +0100
Last post2016-01-01 03:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ata: correctly handling failed allocation Insu Yun <wuninsu@gmail.com> - 2015-12-29 22:20 +0100
    Re: [PATCH] ata: correctly handling failed allocation Tejun Heo <tj@kernel.org> - 2016-01-01 03:40 +0100

#1299142 — [PATCH] ata: correctly handling failed allocation

FromInsu Yun <wuninsu@gmail.com>
Date2015-12-29 22:20 +0100
Subject[PATCH] ata: correctly handling failed allocation
Message-ID<qL9Qt-5OI-1@gated-at.bofh.it>
Since kzalloc can be failed in memory pressure, return error when failed.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/ata/sata_sx4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index fab504f..48301cb 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -1396,6 +1396,8 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
 		addr = 0;
 		length = size * 1024 * 1024;
 		buf = kzalloc(ECC_ERASE_BUF_SZ, GFP_KERNEL);
+		if (!buf)
+			return 1;
 		while (addr < length) {
 			pdc20621_put_to_dimm(host, buf, addr,
 					     ECC_ERASE_BUF_SZ);
-- 
1.9.1

--
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/

[toc] | [next] | [standalone]


#1299821

FromTejun Heo <tj@kernel.org>
Date2016-01-01 03:40 +0100
Message-ID<qLXNg-4bs-3@gated-at.bofh.it>
In reply to#1299142
On Tue, Dec 29, 2015 at 04:21:15PM -0500, Insu Yun wrote:
> Since kzalloc can be failed in memory pressure, return error when failed.
> 
> Signed-off-by: Insu Yun <wuninsu@gmail.com>

Applied to libata/for-4.5.

Thanks.

-- 
tejun
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web