tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git iomap-write head: 3cf7648de3f378723b38a432d620e5c65516844e commit: 6b465904a278c702e9ba1e51c12f82d09ccf88db [1/5] gfs2: Further iomap cleanups
smatch warnings: fs/gfs2/bmap.c:870 gfs2_iomap_get() error: uninitialized symbol 'dibh'. # https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commit/?id=6b465904a278c702e9ba1e51c12f82d09ccf88db git remote add gfs2 https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git git remote update gfs2 git checkout 6b465904a278c702e9ba1e51c12f82d09ccf88db vim +/dibh +870 fs/gfs2/bmap.c 7ee66c03 Christoph Hellwig 2018-06-01 764 3974320c Bob Peterson 2017-02-16 765 /** 628e366d Andreas Gruenbacher 2018-06-04 766 * gfs2_iomap_get - Map blocks from an inode to disk blocks 3974320c Bob Peterson 2017-02-16 767 * @inode: The inode 3974320c Bob Peterson 2017-02-16 768 * @pos: Starting position in bytes 3974320c Bob Peterson 2017-02-16 769 * @length: Length to map, in bytes 3974320c Bob Peterson 2017-02-16 770 * @flags: iomap flags 3974320c Bob Peterson 2017-02-16 771 * @iomap: The iomap structure 628e366d Andreas Gruenbacher 2018-06-04 772 * @mp: The metapath 3974320c Bob Peterson 2017-02-16 773 * 3974320c Bob Peterson 2017-02-16 774 * Returns: errno 3974320c Bob Peterson 2017-02-16 775 */ 628e366d Andreas Gruenbacher 2018-06-04 776 static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length, 628e366d Andreas Gruenbacher 2018-06-04 777 unsigned flags, struct iomap *iomap, 628e366d Andreas Gruenbacher 2018-06-04 778 struct metapath *mp) b3b94faa David Teigland 2006-01-16 779 { feaa7bba Steven Whitehouse 2006-06-14 780 struct gfs2_inode *ip = GFS2_I(inode); feaa7bba Steven Whitehouse 2006-06-14 781 struct gfs2_sbd *sdp = GFS2_SB(inode); 6b465904 Andreas Gruenbacher 2018-06-24 782 loff_t size = i_size_read(inode); 9b8c81d1 Steven Whitehouse 2008-02-22 783 __be64 *ptr; 3974320c Bob Peterson 2017-02-16 784 sector_t lblock; 628e366d Andreas Gruenbacher 2018-06-04 785 sector_t lblock_stop; 628e366d Andreas Gruenbacher 2018-06-04 786 int ret; 9b8c81d1 Steven Whitehouse 2008-02-22 787 int eob; 628e366d Andreas Gruenbacher 2018-06-04 788 u64 len; 6b465904 Andreas Gruenbacher 2018-06-24 789 struct buffer_head *dibh, *bh; 9b8c81d1 Steven Whitehouse 2008-02-22 790 u8 height; 7276b3b0 Steven Whitehouse 2006-09-21 791 628e366d Andreas Gruenbacher 2018-06-04 792 if (!length) 628e366d Andreas Gruenbacher 2018-06-04 793 return -EINVAL; b3b94faa David Teigland 2006-01-16 794 6b465904 Andreas Gruenbacher 2018-06-24 795 down_read(&ip->i_rw_mutex); 6b465904 Andreas Gruenbacher 2018-06-24 796 6b465904 Andreas Gruenbacher 2018-06-24 797 ret = gfs2_meta_inode_buffer(ip, &dibh); 6b465904 Andreas Gruenbacher 2018-06-24 798 if (ret) 6b465904 Andreas Gruenbacher 2018-06-24 799 goto unlock; ^^^^^^^^^^^ My guess is that dibh isn't set on this error path. 6b465904 Andreas Gruenbacher 2018-06-24 800 49edd5bf Andreas Gruenbacher 2018-02-06 801 if (gfs2_is_stuffed(ip)) { 6b465904 Andreas Gruenbacher 2018-06-24 802 if (flags & IOMAP_WRITE) { 6b465904 Andreas Gruenbacher 2018-06-24 803 loff_t max_size = gfs2_max_stuffed_size(ip); 6b465904 Andreas Gruenbacher 2018-06-24 804 6b465904 Andreas Gruenbacher 2018-06-24 805 if (pos + length > max_size) 6b465904 Andreas Gruenbacher 2018-06-24 806 goto unstuff; 6b465904 Andreas Gruenbacher 2018-06-24 807 iomap->length = max_size; 6b465904 Andreas Gruenbacher 2018-06-24 808 } else { 6b465904 Andreas Gruenbacher 2018-06-24 809 if (pos >= size) { 49edd5bf Andreas Gruenbacher 2018-02-06 810 if (flags & IOMAP_REPORT) { 6b465904 Andreas Gruenbacher 2018-06-24 811 ret = -ENOENT; 6b465904 Andreas Gruenbacher 2018-06-24 812 goto unlock; 6b465904 Andreas Gruenbacher 2018-06-24 813 } else { 6b465904 Andreas Gruenbacher 2018-06-24 814 /* report a hole */ 6b465904 Andreas Gruenbacher 2018-06-24 815 iomap->offset = pos; 6b465904 Andreas Gruenbacher 2018-06-24 816 iomap->length = length; 6b465904 Andreas Gruenbacher 2018-06-24 817 goto do_alloc; 6b465904 Andreas Gruenbacher 2018-06-24 818 } 3974320c Bob Peterson 2017-02-16 819 } 6b465904 Andreas Gruenbacher 2018-06-24 820 iomap->length = size; 49edd5bf Andreas Gruenbacher 2018-02-06 821 } 6b465904 Andreas Gruenbacher 2018-06-24 822 iomap->addr = (ip->i_no_addr << inode->i_blkbits) + 6b465904 Andreas Gruenbacher 2018-06-24 823 sizeof(struct gfs2_dinode); 6b465904 Andreas Gruenbacher 2018-06-24 824 iomap->type = IOMAP_INLINE; 6b465904 Andreas Gruenbacher 2018-06-24 825 goto unlock; 6b465904 Andreas Gruenbacher 2018-06-24 826 } 6b465904 Andreas Gruenbacher 2018-06-24 827 6b465904 Andreas Gruenbacher 2018-06-24 828 unstuff: 3974320c Bob Peterson 2017-02-16 829 lblock = pos >> inode->i_blkbits; 3974320c Bob Peterson 2017-02-16 830 iomap->offset = lblock << inode->i_blkbits; 628e366d Andreas Gruenbacher 2018-06-04 831 lblock_stop = (pos + length - 1) >> inode->i_blkbits; 628e366d Andreas Gruenbacher 2018-06-04 832 len = lblock_stop - lblock + 1; 6b465904 Andreas Gruenbacher 2018-06-24 833 iomap->length = len << inode->i_blkbits; 20cdc193 Andreas Gruenbacher 2017-09-22 834 6b465904 Andreas Gruenbacher 2018-06-24 835 get_bh(dibh); 6b465904 Andreas Gruenbacher 2018-06-24 836 mp->mp_bh[0] = dibh; e23159d2 Steven Whitehouse 2008-02-12 837 9b8c81d1 Steven Whitehouse 2008-02-22 838 height = ip->i_height; 9a38662b Andreas Gruenbacher 2018-04-16 839 while ((lblock + 1) * sdp->sd_sb.sb_bsize > sdp->sd_heightsize[height]) ecc30c79 Steven Whitehouse 2008-01-28 840 height++; 628e366d Andreas Gruenbacher 2018-06-04 841 find_metapath(sdp, lblock, mp, height); 9b8c81d1 Steven Whitehouse 2008-02-22 842 if (height > ip->i_height || gfs2_is_stuffed(ip)) 9b8c81d1 Steven Whitehouse 2008-02-22 843 goto do_alloc; 3974320c Bob Peterson 2017-02-16 844 628e366d Andreas Gruenbacher 2018-06-04 845 ret = lookup_metapath(ip, mp); e8b43fe0 Andreas Gruenbacher 2017-12-08 846 if (ret) 628e366d Andreas Gruenbacher 2018-06-04 847 goto unlock; 3974320c Bob Peterson 2017-02-16 848 628e366d Andreas Gruenbacher 2018-06-04 849 if (mp->mp_aheight != ip->i_height) 9b8c81d1 Steven Whitehouse 2008-02-22 850 goto do_alloc; 3974320c Bob Peterson 2017-02-16 851 628e366d Andreas Gruenbacher 2018-06-04 852 ptr = metapointer(ip->i_height - 1, mp); 9b8c81d1 Steven Whitehouse 2008-02-22 853 if (*ptr == 0) 9b8c81d1 Steven Whitehouse 2008-02-22 854 goto do_alloc; 3974320c Bob Peterson 2017-02-16 855 628e366d Andreas Gruenbacher 2018-06-04 856 bh = mp->mp_bh[ip->i_height - 1]; 628e366d Andreas Gruenbacher 2018-06-04 857 len = gfs2_extent_length(bh->b_data, bh->b_size, ptr, len, &eob); 3974320c Bob Peterson 2017-02-16 858 628e366d Andreas Gruenbacher 2018-06-04 859 iomap->addr = be64_to_cpu(*ptr) << inode->i_blkbits; 628e366d Andreas Gruenbacher 2018-06-04 860 iomap->length = len << inode->i_blkbits; 628e366d Andreas Gruenbacher 2018-06-04 861 iomap->type = IOMAP_MAPPED; 628e366d Andreas Gruenbacher 2018-06-04 862 iomap->flags = IOMAP_F_MERGED; 9b8c81d1 Steven Whitehouse 2008-02-22 863 if (eob) 7ee66c03 Christoph Hellwig 2018-06-01 864 iomap->flags |= IOMAP_F_GFS2_BOUNDARY; 3974320c Bob Peterson 2017-02-16 865 3974320c Bob Peterson 2017-02-16 866 out: 628e366d Andreas Gruenbacher 2018-06-04 867 iomap->bdev = inode->i_sb->s_bdev; 628e366d Andreas Gruenbacher 2018-06-04 868 unlock: 628e366d Andreas Gruenbacher 2018-06-04 869 up_read(&ip->i_rw_mutex); 6b465904 Andreas Gruenbacher 2018-06-24 @870 if (dibh) 6b465904 Andreas Gruenbacher 2018-06-24 871 brelse(dibh); ^^^^^^^^^^^^^^^^ 9b8c81d1 Steven Whitehouse 2008-02-22 872 return ret; 9b8c81d1 Steven Whitehouse 2008-02-22 873 9b8c81d1 Steven Whitehouse 2008-02-22 874 do_alloc: 628e366d Andreas Gruenbacher 2018-06-04 875 iomap->addr = IOMAP_NULL_ADDR; 628e366d Andreas Gruenbacher 2018-06-04 876 iomap->type = IOMAP_HOLE; 628e366d Andreas Gruenbacher 2018-06-04 877 if (flags & IOMAP_REPORT) { 49edd5bf Andreas Gruenbacher 2018-02-06 878 if (pos >= size) 3974320c Bob Peterson 2017-02-16 879 ret = -ENOENT; 628e366d Andreas Gruenbacher 2018-06-04 880 else if (height == ip->i_height) 628e366d Andreas Gruenbacher 2018-06-04 881 ret = gfs2_hole_size(inode, lblock, len, mp, iomap); 49edd5bf Andreas Gruenbacher 2018-02-06 882 else 49edd5bf Andreas Gruenbacher 2018-02-06 883 iomap->length = size - pos; 6b465904 Andreas Gruenbacher 2018-06-24 884 } else if (!(flags & IOMAP_WRITE)) { 6b465904 Andreas Gruenbacher 2018-06-24 885 if (pos < size && height == ip->i_height) 6b465904 Andreas Gruenbacher 2018-06-24 886 ret = gfs2_hole_size(inode, lblock, len, mp, iomap); 3974320c Bob Peterson 2017-02-16 887 } 628e366d Andreas Gruenbacher 2018-06-04 888 goto out; 628e366d Andreas Gruenbacher 2018-06-04 889 } 628e366d Andreas Gruenbacher 2018-06-04 890 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
