Commit 787bc776 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix NULL pointer dereference in blkmtd.c

From: Michel Marti <michel.marti@objectxp.com>

The blkmtd driver oopses in add_device().  The following trivial patch
fixes this.
parent 132a4161
......@@ -664,12 +664,12 @@ static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size
}
memset(dev, 0, sizeof(struct blkmtd_dev));
dev->blkdev = bdev;
atomic_set(&(dev->blkdev->bd_inode->i_mapping->truncate_count), 0);
if(!readonly) {
init_MUTEX(&dev->wrbuf_mutex);
}
dev->blkdev = bdev;
dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
/* Setup the MTD structure */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment