mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Panagiotis Issaris" <panagiotis.issaris@mech.kuleuven.ac.be>
To: gerg@snapgear.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.11-mm1] mtd: fix INFTL failure handling
Date: Sun, 6 Mar 2005 18:51:39 +0100	[thread overview]
Message-ID: <20050306175139.GA6192@mech.kuleuven.ac.be> (raw)

Hi,

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>

diff -pruN linux-2.6.11-orig/drivers/mtd/inftlmount.c linux-2.6.11-pi/drivers/mtd/inftlmount.c
--- linux-2.6.11-orig/drivers/mtd/inftlmount.c	2005-03-05 03:08:52.000000000 +0100
+++ linux-2.6.11-pi/drivers/mtd/inftlmount.c	2005-03-06 18:17:15.000000000 +0100
@@ -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);
 
 	/*

             reply	other threads:[~2005-03-06 17:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-06 17:51 Panagiotis Issaris [this message]
2005-03-07  1:12 ` Greg Ungerer

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=20050306175139.GA6192@mech.kuleuven.ac.be \
    --to=panagiotis.issaris@mech.kuleuven.ac.be \
    --cc=gerg@snapgear.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®