[LLVMbugs] [Bug 8697] New: Field access results in a dereference of a null pointer (loaded from variable 'l')

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 25 13:41:26 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8697

           Summary: Field access results in a dereference of a null
                    pointer (loaded from variable 'l')
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: zdenek.kabelac at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Bug reported by the clang static analyzer.

Description: Field access results in a dereference of a null pointer (loaded
from variable 'l')
File: lvm2.git/lib/config/config.c
Line: 618

This case seems to be quite clear - allocated area for root node is in fact
memset() to 0 - but analyzer seems to think there is chance to have path 
!root->child not executed first - so gives false positive about possible null
dereference.

As an easy hack could be used   'root->child = NULL'  after root node is
allocated - but that's ugly.

Is there a way to instrument with same attribute that given array is zeroed?

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list