[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: <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Greg Ungerer authored and Linus Torvalds committed 2005-11-07 08:00:46 -08:00
1 parent 3aec6fe2a2
commit 8766af935f
1 file changed
+6
+6
View File
@@ -574,6 +574,12 @@ int INFTL_mount(struct INFTLrecord *s)
/* Temporary buffer to store ANAC numbers. */
ANACtable = kmalloc(s->nb_blocks * sizeof(u8), GFP_KERNEL);
if (!ANACtable) {
printk(KERN_WARNING "INFTL: allocation of ANACtable "
"failed (%zd bytes)\n",
s->nb_blocks * sizeof(u8));
return -ENOMEM;
}
memset(ANACtable, 0, s->nb_blocks);
/*