Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1299142
| From | Insu Yun <wuninsu@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] ata: correctly handling failed allocation |
| Date | 2015-12-29 22:20 +0100 |
| Message-ID | <qL9Qt-5OI-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[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
csiph-web