Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.infradead.org/~dwmw2/mtd-2.6.31

* git://git.infradead.org/~dwmw2/mtd-2.6.31:
JFFS2: add missing verify buffer allocation/deallocation
mtd: nftl: fix offset alignments
mtd: nftl: write support is broken
mtd: m25p80: fix null pointer dereference bug

+20 -7
+1 -1
drivers/mtd/devices/m25p80.c
··· 736 736 flash->partitioned = 1; 737 737 return add_mtd_partitions(&flash->mtd, parts, nr_parts); 738 738 } 739 - } else if (data->nr_parts) 739 + } else if (data && data->nr_parts) 740 740 dev_warn(&spi->dev, "ignoring %d default partitions on %s\n", 741 741 data->nr_parts, data->name); 742 742
+9 -6
drivers/mtd/nftlcore.c
··· 135 135 int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, 136 136 size_t *retlen, uint8_t *buf) 137 137 { 138 + loff_t mask = mtd->writesize - 1; 138 139 struct mtd_oob_ops ops; 139 140 int res; 140 141 141 142 ops.mode = MTD_OOB_PLACE; 142 - ops.ooboffs = offs & (mtd->writesize - 1); 143 + ops.ooboffs = offs & mask; 143 144 ops.ooblen = len; 144 145 ops.oobbuf = buf; 145 146 ops.datbuf = NULL; 146 147 147 - res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); 148 + res = mtd->read_oob(mtd, offs & ~mask, &ops); 148 149 *retlen = ops.oobretlen; 149 150 return res; 150 151 } ··· 156 155 int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, 157 156 size_t *retlen, uint8_t *buf) 158 157 { 158 + loff_t mask = mtd->writesize - 1; 159 159 struct mtd_oob_ops ops; 160 160 int res; 161 161 162 162 ops.mode = MTD_OOB_PLACE; 163 - ops.ooboffs = offs & (mtd->writesize - 1); 163 + ops.ooboffs = offs & mask; 164 164 ops.ooblen = len; 165 165 ops.oobbuf = buf; 166 166 ops.datbuf = NULL; 167 167 168 - res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); 168 + res = mtd->write_oob(mtd, offs & ~mask, &ops); 169 169 *retlen = ops.oobretlen; 170 170 return res; 171 171 } ··· 179 177 static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len, 180 178 size_t *retlen, uint8_t *buf, uint8_t *oob) 181 179 { 180 + loff_t mask = mtd->writesize - 1; 182 181 struct mtd_oob_ops ops; 183 182 int res; 184 183 185 184 ops.mode = MTD_OOB_PLACE; 186 - ops.ooboffs = offs; 185 + ops.ooboffs = offs & mask; 187 186 ops.ooblen = mtd->oobsize; 188 187 ops.oobbuf = oob; 189 188 ops.datbuf = buf; 190 189 ops.len = len; 191 190 192 - res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); 191 + res = mtd->write_oob(mtd, offs & ~mask, &ops); 193 192 *retlen = ops.retlen; 194 193 return res; 195 194 }
+10
fs/jffs2/wbuf.c
··· 1268 1268 if (!c->wbuf) 1269 1269 return -ENOMEM; 1270 1270 1271 + #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY 1272 + c->wbuf_verify = kmalloc(c->wbuf_pagesize, GFP_KERNEL); 1273 + if (!c->wbuf_verify) { 1274 + kfree(c->wbuf); 1275 + return -ENOMEM; 1276 + } 1277 + #endif 1271 1278 return 0; 1272 1279 } 1273 1280 1274 1281 void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { 1282 + #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY 1283 + kfree(c->wbuf_verify); 1284 + #endif 1275 1285 kfree(c->wbuf); 1276 1286 } 1277 1287