Skip to contentSkip to conversation

Handle possible bio_alloc failure in bounce buffer

PATCH NAK Nikanth Karthikesan 1 participant 1 message Apr 14, 2009 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 Handle possible bio_alloc failure in bounce buffer

Handle possible bio_alloc failure in bounce buffer.

---

mm/bounce.c +3 -0
Index: linux-2.6/mm/bounce.c
===================================================================
@@ -202,6 +202,9 @@ static void __blk_queue_bounce(struct re
 			unsigned int cnt = (*bio_orig)->bi_vcnt;
 
 			bio = bio_alloc(GFP_NOIO, cnt);
+			if (unlikely(!bio))
+				panic("Unable to allocate bios\n");
+			
 			memset(bio->bi_io_vec, 0, cnt * sizeof(struct bio_vec));
 		}