smatch warning in mm/mmap.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rik,

This code generates a Smatch warning.  I normally ignore Smatch warnings
in mm because I'm not clever enough to mess with that, but this one is
pretty recent so I thought I'd ask.  Could you take a look?

mm/mmap.c +1980 __split_vma(57) error: we previously assumed 'new->vm_ops' could be null.
  1966          if (new->vm_ops && new->vm_ops->open)
                    ^^^^^^^^^^^
	We assume new->vm_ops can be NULL here.

  1967                  new->vm_ops->open(new);
  1968
  1969          if (new_below)
  1970                  err = vma_adjust(vma, addr, vma->vm_end, vma->vm_pgoff +
  1971                          ((addr - new->vm_start) >> PAGE_SHIFT), new);
  1972          else
  1973                  err = vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
  1974
  1975          /* Success. */
  1976          if (!err)
  1977                  return 0;
  1978
  1979          /* Clean everything up if vma_adjust failed. */
  1980          new->vm_ops->close(new);
                ^^^^^^^^^^^^^^^^^^

	But we dereference it unconditionally here.  

The dereference was added in 5beb4930: "mm: change anon_vma linking to fix
multi-process server scalability issue".

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]