Showing error 1872

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


Source:

210        return 0;
211}
212
213/* Doesn't set inode->i_size */
214static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *root, struct jffs2_node_frag *newfrag)
215{
216        struct jffs2_node_frag *this;
217        uint32_t lastend;
218
219        /* Skip all the nodes which are completed before this one starts */
220        this = jffs2_lookup_node_frag(root, newfrag->node->ofs);
221
222        if (this) {
223                dbg_fragtree2("lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
224                          this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
225                lastend = this->ofs + this->size;
226        } else {
227                dbg_fragtree2("lookup gave no frag\n");
228                lastend = 0;
229        }
230
231        /* See if we ran off the end of the fragtree */
232        if (lastend <= newfrag->ofs) {
233                /* We did */
234
235                /* Check if 'this' node was on the same page as the new node.
236                   If so, both 'this' and the new node get marked REF_NORMAL so
237                   the GC can take a look.
238                */
239                if (lastend && (lastend-1) >> PAGE_CACHE_SHIFT == newfrag->ofs >> PAGE_CACHE_SHIFT) {
240                        if (this->node)
241                                mark_ref_normal(this->node->raw);
242                        mark_ref_normal(newfrag->node->raw);
243                }
244
245                return no_overlapping_node(c, root, newfrag, this, lastend);
246        }
247
248        if (this->node)
249                dbg_fragtree2("dealing with frag %u-%u, phys %#08x(%d).\n",
250                this->ofs, this->ofs + this->size,
Show full sources