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


From cppcheck

Jump to: navigation, search


Scan report

Project: Linux Kernel 3.0.1

Date: 2012-02-18

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-120218.xml
 xsltproc uninitvar.xsl cppcheck-results-120218.xml


 <?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>

Results with comments

 [drivers/atm/fore200e.c:2818] Uninitialized variable: err
   => 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/staging/mei/interrupt.c:253] Uninitialized variable: buffer
   => true positive
 [drivers/staging/xgifb/vb_setmode.c:1507] Uninitialized variable: VCLKIndex
   => true positive (if execution reaches line 1431 and the condition is false. Since it's a condition cppcheck assumes that it can be false but logically this condition can never be false)
 [drivers/tty/serial/68360serial.c:2248] Uninitialized variable: up
   => true positive
 [drivers/usb/serial/mos7840.c:1445] Uninitialized variable: mos7840_port
   => true positive
 [drivers/video/cyber2000fb.c:1941] Uninitialized variable: err
   => true positive

False negatives

In the 2011-12-11 checking this error was detected:

 [drivers/net/cassini.c:2455] Uninitialized variable: ring

Since it was determined that this was a true positive. It is a false negative.

Personal tools