diff options
author | Greg Ungerer <gerg@snapgear.com> | 2005-11-06 23:09:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 11:00:46 -0500 |
commit | 8766af935f3f018ec4fd420644360643838ec323 (patch) | |
tree | 2c6c07bf6acc1fe68782608ec116b76a38385a8f /drivers | |
parent | 3aec6fe2a24067ffeb2e7641bd9dd18e41654842 (diff) |
[PATCH] check for failed kmalloc in inftlmount.c
The INFTL mount code contains a kmalloc() followed by a memset() without
handling a possible memory allocation failure.
Signed-off-by: <panagiotis.issaris@mech.kuleuven.ac.be>
Signed-off-by: Greg Ungerer <gerg@uclinux.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/inftlmount.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index b5dda47395a7..3dac53feeee2 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c | |||
@@ -574,6 +574,12 @@ int INFTL_mount(struct INFTLrecord *s) | |||
574 | 574 | ||
575 | /* Temporary buffer to store ANAC numbers. */ | 575 | /* Temporary buffer to store ANAC numbers. */ |
576 | ANACtable = kmalloc(s->nb_blocks * sizeof(u8), GFP_KERNEL); | 576 | ANACtable = kmalloc(s->nb_blocks * sizeof(u8), GFP_KERNEL); |
577 | if (!ANACtable) { | ||
578 | printk(KERN_WARNING "INFTL: allocation of ANACtable " | ||
579 | "failed (%zd bytes)\n", | ||
580 | s->nb_blocks * sizeof(u8)); | ||
581 | return -ENOMEM; | ||
582 | } | ||
577 | memset(ANACtable, 0, s->nb_blocks); | 583 | memset(ANACtable, 0, s->nb_blocks); |
578 | 584 | ||
579 | /* | 585 | /* |