Showing error 1662

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: fs/xfs/xfs_bmap.c
Line in file: 5928
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

5898        bmapi_flags = XFS_BMAPI_AFLAG(whichfork) |
5899                        ((sh_unwritten) ? 0 : XFS_BMAPI_IGSTATE);
5900
5901        /*
5902         * Allocate enough space to handle "subnex" maps at a time.
5903         */
5904        subnex = 16;
5905        map = kmem_alloc(subnex * sizeof(*map), KM_SLEEP);
5906
5907        bmv->bmv_entries = 0;
5908
5909        if (XFS_IFORK_NEXTENTS(ip, whichfork) == 0) {
5910                error = 0;
5911                goto unlock_and_return;
5912        }
5913
5914        nexleft = nex;
5915
5916        do {
5917                nmap = (nexleft > subnex) ? subnex : nexleft;
5918                error = xfs_bmapi(NULL, ip, XFS_BB_TO_FSBT(mp, bmv->bmv_offset),
5919                                  XFS_BB_TO_FSB(mp, bmv->bmv_length),
5920                                  bmapi_flags, NULL, 0, map, &nmap,
5921                                  NULL, NULL);
5922                if (error)
5923                        goto unlock_and_return;
5924                ASSERT(nmap <= subnex);
5925
5926                for (i = 0; i < nmap && nexleft && bmv->bmv_length; i++) {
5927                        nexleft--;
5928                        oflags = (map[i].br_state == XFS_EXT_UNWRITTEN) ?
5929                                        BMV_OF_PREALLOC : 0;
5930                        out.bmv_offset = XFS_FSB_TO_BB(mp, map[i].br_startoff);
5931                        out.bmv_length = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
5932                        ASSERT(map[i].br_startblock != DELAYSTARTBLOCK);
5933                        if (map[i].br_startblock == HOLESTARTBLOCK &&
5934                            whichfork == XFS_ATTR_FORK) {
5935                                /* came to the end of attribute fork */
5936                                goto unlock_and_return;
5937                        } else {
5938                                if (!xfs_getbmapx_fix_eof_hole(ip, &out,
Show full sources