1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

ScanLinuxKernel/20111219-uninitvar

From cppcheck

Jump to: navigation, search

Scan report

Project: Linux Kernel 3.0.1

Date: 2011-12-19

Cppcheck: latest git head

NOTE: I was interested to test the new check for uninitialized variables. So I disabled the old ExecutionPaths check by commenting out the "checkUninitVar.executionPaths();".

Commands used:

 cppcheck -j2 --xml-version=2 drivers 2> cppcheck-results-111219.xml
 xsltproc uninitvar.xsl cppcheck-results->111219.xml


uninitvar.xsl

 <?xml version="1.0"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="text"/>
 <xsl:template match="/">
   <xsl:for-each select="results/errors/error[@id='uninitvar']">[<xsl:value-of select="location/@file"/>:<xsl:value-of select="location/@line"/>] <xsl:value-of select="@msg"/><xsl:text>
 </xsl:text></xsl:for-each>
 </xsl:template>
 </xsl:stylesheet> 


Results with comments

 [drivers/atm/fore200e.c:2818] Uninitialized variable: err
   => true positive
 [drivers/net/cassini.c:2455] Uninitialized variable: ring
   => true positive
 [drivers/net/smc91x.c:558] Uninitialized variable: flags
   => true positive because the macro expands to (flags == flags)
 [drivers/staging/gma500/psb_gtt.c:237] Uninitialized variable: ret
   => true positive
 [drivers/staging/intel_sst/intel_sst_stream_encoded.c:893] Uninitialized variable: i
 [drivers/staging/intel_sst/intel_sst_stream_encoded.c:900] Uninitialized variable: i
   => true positive
 [drivers/video/cyber2000fb.c:1941] Uninitialized variable: err
   => true positive
Personal tools