mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kevin Corry <corry@ecn.purdue.edu>
To: joe@fib011235813.fsnet.co.uk (Joe Thornber)
Cc: dm-devel@sistina.com, linux-kernel@vger.kernel.org
Subject: [PATCH] dm.c : Check memory allocations
Date: Fri, 27 Dec 2002 16:55:31 -0500 (EST)	[thread overview]
Message-ID: <200212272155.gBRLtWD7013508@shay.ecn.purdue.edu> (raw)

Check memory allocations when cloning bio's.

--- linux-2.5.53a/drivers/md/dm.c	Mon Dec 23 23:21:04 2002
+++ linux-2.5.53b/drivers/md/dm.c	Fri Dec 27 14:50:29 2002
@@ -394,6 +393,10 @@
 		 */
 		clone = clone_bio(bio, ci->sector, ci->idx,
 				  bio->bi_vcnt - ci->idx, ci->sector_count);
+		if (!clone) {
+			dec_pending(ci->io, -ENOMEM);
+			return;
+		}
 		__map_bio(ti, clone, ci->io);
 		ci->sector_count = 0;
 
@@ -417,6 +420,10 @@
 		}
 
 		clone = clone_bio(bio, ci->sector, ci->idx, i - ci->idx, len);
+		if (!clone) {
+			dec_pending(ci->io, -ENOMEM);
+			return;
+		}
 		__map_bio(ti, clone, ci->io);
 
 		ci->sector += len;

             reply	other threads:[~2002-12-27 21:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-27 21:55 Kevin Corry [this message]
2002-12-27 22:00 ` Jeff Garzik
2002-12-27 22:16   ` Kevin Corry
2002-12-30 10:51 ` Joe Thornber
2002-12-31 16:22   ` Kevin Corry
2003-01-02  9:55     ` Joe Thornber

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=200212272155.gBRLtWD7013508@shay.ecn.purdue.edu \
    --to=corry@ecn.purdue.edu \
    --cc=dm-devel@sistina.com \
    --cc=joe@fib011235813.fsnet.co.uk \
    --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®