Showing error 1870

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: fs/hpfs/dnode.c
Line in file: 44
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

  14        struct hpfs_dirent *de_end = dnode_end_de(d);
  15        int i = 1;
  16        for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {
  17                if (de == fde) return ((loff_t) d->self << 4) | (loff_t)i;
  18                i++;
  19        }
  20        printk("HPFS: get_pos: not_found\n");
  21        return ((loff_t)d->self << 4) | (loff_t)1;
  22}
  23
  24void hpfs_add_pos(struct inode *inode, loff_t *pos)
  25{
  26        struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
  27        int i = 0;
  28        loff_t **ppos;
  29
  30        if (hpfs_inode->i_rddir_off)
  31                for (; hpfs_inode->i_rddir_off[i]; i++)
  32                        if (hpfs_inode->i_rddir_off[i] == pos) return;
  33        if (!(i&0x0f)) {
  34                if (!(ppos = kmalloc((i+0x11) * sizeof(loff_t*), GFP_NOFS))) {
  35                        printk("HPFS: out of memory for position list\n");
  36                        return;
  37                }
  38                if (hpfs_inode->i_rddir_off) {
  39                        memcpy(ppos, hpfs_inode->i_rddir_off, i * sizeof(loff_t));
  40                        kfree(hpfs_inode->i_rddir_off);
  41                }
  42                hpfs_inode->i_rddir_off = ppos;
  43        }
  44        hpfs_inode->i_rddir_off[i] = pos;
  45        hpfs_inode->i_rddir_off[i + 1] = NULL;
  46}
  47
  48void hpfs_del_pos(struct inode *inode, loff_t *pos)
  49{
  50        struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
  51        loff_t **i, **j;
  52
  53        if (!hpfs_inode->i_rddir_off) goto not_f;
  54        for (i = hpfs_inode->i_rddir_off; *i; i++) if (*i == pos) goto fnd;
Show full sources