User: | Jiri Slaby |
Error type: | Invalid Pointer Dereference |
Error type description: | A pointer which is invalid is being dereferenced |
File location: | fs/xfs/xfs_dir2.c |
Line in file: | 585 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Smatch
(1.59)
|
Entered: | 2013-09-10 07:54:05 UTC |
555 ASSERT(nmap <= 1); 556 if (nmap == 1) { 557 mapp = ↦ 558 mapi = 1; 559 } 560 /* 561 * Didn't work and this is a multiple-fsb directory block. 562 * Try again with contiguous flag turned on. 563 */ 564 else if (nmap == 0 && count > 1) { 565 xfs_fileoff_t b; /* current file offset */ 566 567 /* 568 * Space for maximum number of mappings. 569 */ 570 mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP); 571 /* 572 * Iterate until we get to the end of our block. 573 */ 574 for (b = bno, mapi = 0; b < bno + count; ) { 575 int c; /* current fsb count */ 576 577 /* 578 * Can't map more than MAX_NMAP at once. 579 */ 580 nmap = MIN(XFS_BMAP_MAX_NMAP, count); 581 c = (int)(bno + count - b); 582 if ((error = xfs_bmapi(tp, dp, b, c, 583 XFS_BMAPI_WRITE|XFS_BMAPI_METADATA, 584 args->firstblock, args->total, 585 &mapp[mapi], &nmap, args->flist, 586 NULL))) { 587 kmem_free(mapp); 588 return error; 589 } 590 if (nmap < 1) 591 break; 592 /* 593 * Add this bunch into our table, go to the next offset. 594 */ 595 mapi += nmap;