MISRA C:2012 with Amendment 2 rules mapped to Klocwork certified checkers

MISRA C Rule Category Decidable? Klocwork Checker Code and Description
Dir. 1.1 Required No

 

Dir. 2.1 Required No

 

Dir. 3.1 Required No

 

Dir. 4.1 Required No

 

Dir. 4.2 Advisory No

 

Dir. 4.3 Required No

MISRA.ASM.ENCAPS  Assembly language is not isolated.

Dir. 4.4 Advisory No

 

Dir. 4.5 Advisory No

 

Dir. 4.6 Advisory No

MISRA.BUILTIN_NUMERIC  Builtin numeric type is used

Dir. 4.7 Required No

SV.RVT.RETVAL_NOTTESTED  Ignored Return Value

Dir. 4.8 Advisory No

 

Dir. 4.9 Advisory No

MISRA.DEFINE.FUNC  Function-like macro definition

Dir. 4.10 Required No

MISRA.INCGUARD  Include guard is not provided

Dir. 4.11 Required No

 

Dir. 4.12 Required No

 

Dir. 4.13 Advisory No

 

Dir. 4.14 Required No

ABV.TAINTED  Buffer Overflow from Unvalidated Input

NNTS.TAINTED  Unvalidated User Input Causing Buffer Overflow - Non-Null Terminated String

SV.TAINTED.ALLOC_SIZE  Use of Unvalidated Integer in Memory Allocation

SV.TAINTED.BINOP  Use of Unvalidated Integer in Binary Operation

SV.TAINTED.CALL.BINOP  Use of Unvalidated Integer in Binary Operation

SV.TAINTED.CALL.DEREF  Dereference Of An Unvalidated Pointer

SV.TAINTED.CALL.INDEX_ACCESS  Use of Unvalidated Integer as Array Index by Function Call

SV.TAINTED.CALL.LOOP_BOUND  Use of Unvalidated Integer in Loop Condition through a Function Call

SV.TAINTED.DEREF  Dereference Of An Unvalidated Pointer

SV.TAINTED.FMTSTR  Use of Unvalidated Data in a Format String

SV.TAINTED.INDEX_ACCESS  Use of Unvalidated Integer as Array Index

SV.TAINTED.INJECTION  Command Injection

SV.TAINTED.LOOP_BOUND  Use of Unvalidated Integer in Loop Condition

SV.TAINTED.PATH_TRAVERSAL  Use of Unvalidated Data in a Path Traversal

SV.TAINTED.SECURITY_DECISION  Security Decision

1.1 Required Yes

 

1.2 Advisory No

 

1.3 Required No

 

1.4 Required Yes

 

2.1 Required No

UNREACH.ENUM  Code is unreachable due to the possible value(s) of an enum

UNREACH.GEN  Unreachable code

UNREACH.RETURN  Unreachable Void Return

2.2 Required No

EFFECT  Statement has no effect

LV_UNUSED.GEN  Local variable unused

VA_UNUSED.GEN  Value is Never Used after Assignment

VA_UNUSED.INIT  Value is Never Used after Initialization

2.3 Advisory Yes

 

2.4 Advisory Yes

 

2.5 Advisory Yes

 

2.6 Advisory Yes

LA_UNUSED  Label unused

2.7 Advisory Yes

MISRA.FUNC.UNUSEDPAR.2012  Unused parameters in functions

3.1 Required Yes

MISRA.TOKEN.BADCOM  Inappropriate character sequence in a comment

3.2 Required Yes

MISRA.TOKEN.CPCOM.MULTILINE.2012  Line-splicing used in a // comment

4.1 Required Yes

MISRA.TOKEN.UNTERMINATED.ESCAPE.2012  Unterminated escape sequence in a string literal

4.2 Advisory Yes

MISRA.CHAR.TRIGRAPH  Trigraph usage

5.1 Required Yes

 

5.2 Required Yes

MISRA.IDENT.DISTINCT.C99.2012  Identifiers declared in the same scope or name space are not distinct

5.3 Required Yes

MISRA.VAR.HIDDEN  Identifier declared in an inner scope hides identifier in outer scope

5.4 Required Yes

MISRA.DEFINE.NOT_DISTINCT.C99.2012  Identifier name is too long

5.5 Required Yes

 

5.6 Required Yes

MISRA.TYPEDEF.NOT_UNIQUE  Typedef name is used for another entity

5.7 Required Yes

MISRA.CT.UNIQUE.ID.2012  Identifier clashes with tag name

5.8 Required Yes

MISRA.IDENT.NONUNIQUE.EXTERNAL.2012  Identifiers that define objects or functions with external linkage shall be unique.

5.9 Advisory Yes

MISRA.IDENT.NONUNIQUE.INTERNAL.2012  Identifiers that define objects or functions with internal linkage should be unique.

6.1 Required Yes

MISRA.BITFIELD.TYPE.2012  Type of bit-field is neither bool, nor signed/unsigned integer

6.2 Required Yes

MISRA.BITFIELD.SIGNED  Length of a named signed bit-field is less than 2

7.1 Required Yes

MISRA.TOKEN.OCTAL.INT  Usage of octal integer constants

7.2 Required Yes

MISRA.LITERAL.UNSIGNED.SUFFIX  Unsigned integer literal without 'U' suffix

7.3 Required Yes

MISRA.TOKEN.L.SUFFIX.FLOAT  Usage of lowercase character "l" suffix in floating constant

MISRA.TOKEN.L.SUFFIX.INT  Usage of lowercase character "l" suffix in integer constant

7.4 Required Yes

MISRA.STRING_LITERAL.NON_CONST.2012  A string literal shall not be assigned to an object unless the object's type is pointer to const-qualified char

8.2 Required Yes

MISRA.FUNC.NO_PARAMS  Function without parameters is missing void parameter type

MISRA.FUNC.PROT_FORM.KR.2012  Function types shall be in prototype form

MISRA.FUNC.UNMATCHED.PARAMS  Number of formal and actual parameters passed to function do not match

MISRA.FUNC.UNNAMED.PARAMS  Function declaration has unnamed parameters

8.3 Required Yes

 

8.4 Required Yes

MISRA.FUNC.NOPROT.DEF.2012  Function has a definition but no prototype

8.5 Required Yes

 

8.6 Required Yes

 

8.7 Advisory Yes

 

8.8 Required Yes

MISRA.FUNC.STATIC.REDECL  Function or object redeclaration does not include 'static' modifier

8.9 Advisory Yes

 

8.10 Required Yes

MISRA.DECL.FUNC.INLINE.STATIC.2012  Declaration of inline function without static storage class

8.11 Advisory Yes

MISRA.DECL.ARRAY_SIZE  Declaration of array with unknown size

8.12 Required Yes

MISRA.ENUM.IMPLICIT.VAL.NON_UNIQUE.2012  Implicit enumerator value is not unique

8.13 Advisory No

MISRA.PPARAM.NEEDS.CONST  Pointer parameter is not used to modify the addressed object but is not declared as a pointer to const

8.14 Required Yes

MISRA.TYPE.RESTRICT.QUAL.2012  The restrict type qualifier shall not be used

9.1 Mandatory No

UNINIT.HEAP.MIGHT  Uninitialized Heap Use - possible

UNINIT.HEAP.MUST  Uninitialized Heap Use

UNINIT.STACK.ARRAY.MIGHT  Uninitialized Array - possible

UNINIT.STACK.ARRAY.MUST  Uninitialized Array

UNINIT.STACK.ARRAY.PARTIAL.MUST  Partially Uninitialized Array

UNINIT.STACK.MIGHT  Uninitialized Variable - possible

UNINIT.STACK.MUST  Uninitialized Variable

9.2 Required Yes

MISRA.INIT.BRACES.2012  The initializer for an aggregate or union is not enclosed in braces

9.3 Required Yes

MISRA.INIT.PARTIAL.2012  Array is partially initialized

9.4 Required Yes

MISRA.INIT.MULTIPLE.2012  An element of an object is initialized more than once

9.5 Required Yes

MISRA.INIT.SIZE.IMPLICIT.2012  A designated initializer is used to initialize an array object when the size of the array is not specified explicitly

10.1 Required Yes

MISRA.ETYPE.INAPPR.OPERAND.BINOP.2012  Operand(s) to a binary operator have inappropriate essential type

MISRA.ETYPE.INAPPR.OPERAND.INDEXPR.2012  Index expression has inappropriate essential type

MISRA.ETYPE.INAPPR.OPERAND.TERNOP.2012  First operand to a ternary operator has inappropriate essential type

MISRA.ETYPE.INAPPR.OPERAND.UNOP.2012  Operand to a unary operator has inappropriate essential type

10.2 Required Yes

MISRA.ETYPE.INAPPR.CHAR.2012  Inappropriate usage of Essentially Character type in an addition or subtraction operation

10.3 Required Yes

MISRA.ETYPE.ASSIGN.2012  Assignment to an object of a narrower essential type or a different essential type category

10.4 Required Yes

MISRA.ETYPE.CATEGORY.DIFFERENT.2012  The operands of an operator in which the usual arithmetic conversions are performed do not have the same essential type category

10.5 Advisory Yes

MISRA.ETYPE.INAPPR.CAST.2012  The value of an expression is cast to an inappropriate essential type

10.6 Required Yes

MISRA.ETYPE.COMP.ASSIGN.2012  The value of a composite expression is assigned to an object with a wider essential type

10.7 Required Yes

MISRA.ETYPE.COMP.CAST.IMPL.WIDER.2012  A composite expression used as an operand of an operator in which the usual arithmetic conversions are performed has its other operand having a wider essential type

10.8 Required Yes

MISRA.ETYPE.COMP.CAST.EXPL.DIFFERENT.2012  The value of a composite expression is cast to a different essential type category

MISRA.ETYPE.COMP.CAST.EXPL.WIDER.2012  The value of a composite expression is cast to a wider essential type

11.1 Required Yes

MISRA.CAST.FUNC_PTR.2012  Conversion performed between a pointer to a function and another incompatible type

11.2 Required Yes

MISRA.CAST.INCOMPLETE_PTR_TO_ANY.2012  Conversion performed between a pointer to an incomplete type and a different type

11.3 Required Yes

MISRA.CAST.OBJ_PTR_TO_OBJ_PTR.2012  Cast between a pointer to object type and a pointer to a different object type

11.4 Advisory Yes

MISRA.CAST.OBJ_PTR_TO_INT.2012  Conversion performed between a pointer to an object and an integer type

11.5 Advisory Yes

MISRA.CAST.VOID_PTR_TO_OBJ_PTR.2012  Conversion performed from a pointer to void to a pointer to an object

11.6 Required Yes

MISRA.CAST.VOID_PTR_TO_INT.2012  Cast between a pointer to void and an arithmetic type

11.7 Required Yes

MISRA.CAST.OBJ_PTR_TO_NON_INT.2012  A cast between a pointer to object and a non-integer arithmetic type

11.8 Required Yes

MISRA.CAST.CONST  Cast operation removes const or volatile modifier from a pointer or reference

11.9 Required Yes

MISRA.LITERAL.NULL.PTR.CONST.2012  The macro NULL is the only permitted form of integer null pointer constant

12.1 Advisory Yes

MISRA.EXPR.PARENS.2012  The precedence of operators within expressions should be made explicit.

MISRA.EXPR.PARENS.SIZEOF.2012  The operand of the sizeof operator should be parenthesized.

12.2 Required No

MISRA.SHIFT.RANGE.2012  Right operand of shift operation is out of range - greater or equal to the essential type size of left operand, or is negative

12.3 Advisory Yes

MISRA.COMMA  Comma operator is used

12.4 Advisory Yes

MISRA.COMP.WRAPAROUND  Wrap-around in a condition

12.5 Mandatory Yes

MISRA.EXPR.SIZEOF.ARRAY_PARAM.2012_AMD1  The sizeof operator has an operand which is a function parameter declared as "array of type"

13.1 Required No

 

13.2 Required No

PORTING.VAR.EFFECTS  Variable used twice in one expression where one usage is subject to side-effects

13.3 Advisory Yes

MISRA.INCR_DECR.SIDEEFF.2012  A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator

13.4 Advisory Yes

MISRA.ASSIGN.SUBEXPR.2012  The result of an assignment operator is used

13.5 Required No

MISRA.LOGIC.SIDEEFF  Right operand in a logical 'and' or 'or' expression contains side effects

13.6 Mandatory Yes

MISRA.SIZEOF.SIDE_EFFECT  Operand of sizeof has side effects

14.1 Required No

MISRA.FOR.COUNTER.FLT  For loop counter has a floating point type

14.2 Required No

 

14.3 Required No

INVARIANT_CONDITION.GEN  Invariant expression in a condition

INVARIANT_CONDITION.UNREACH  Invariant expression in a condition

14.4 Required Yes

MISRA.STMT.COND.NOT_BOOLEAN.2012  The controlling expression of an if statement or loop statement is not 'Essentially Boolean' type

15.1 Advisory Yes

MISRA.GOTO  Goto statement is used

15.2 Required Yes

MISRA.GOTO.AFTER_LABEL.2012  Goto jumps to label declared before in same function.

15.3 Required Yes

MISRA.GOTO.NESTED.2012  Label referenced by goto is not in this or enclosing block.

15.4 Advisory Yes

MISRA.BREAK_OR_GOTO.MULTIPLE.2012  Iteration statement has more than one break or goto for loop termination.

15.5 Advisory Yes

MISRA.RETURN.NOT_LAST  Return is not the last statement in a function

15.6 Required Yes

MISRA.IF.NO_COMPOUND  The body of if/else statement is not a compound statement

MISRA.STMT.NO_COMPOUND  The body of switch, while, do/while or for statement is not a compound statement

15.7 Required Yes

MISRA.IF.NO_ELSE  A chain of if/else-if statements is not terminated with else or is terminated with an empty else clause

16.1 Required Yes

MISRA.SWITCH.WELL_FORMED.2012  All switch statements shall be well-formed.

16.2 Required Yes

MISRA.SWITCH.WELL_FORMED.NESTED_LABEL.2012  A switch label shall only be used when the most closely-enclosing compound statement is the body of the switch statement.

16.3 Required Yes

MISRA.SWITCH.WELL_FORMED.BREAK.2012  An unconditional break statement shall terminate every switch-clause.

16.4 Required Yes

MISRA.SWITCH.WELL_FORMED.DEFAULT.2012  Every switch statement shall have a default label.

16.5 Required Yes

MISRA.SWITCH.WELL_FORMED.DEFAULT.FIRST_OR_LAST.2012  A default label shall appear as either the first or the last switch label of a switch statement.

16.6 Required Yes

MISRA.SWITCH.WELL_FORMED.TWO_CLAUSES.2012  Every switch statement shall have at least two switch-clauses.

16.7 Required Yes

MISRA.SWITCH.COND.BOOL.2012  A switch-expression shall not have essentially Boolean type.

17.1 Required Yes

MISRA.FUNC.VARARG  Function with variable number of arguments

17.2 Required No

MISRA.FUNC.RECUR  Recursive function

17.4 Mandatory Yes

FUNCRET.GEN  Non-void function does not return value

FUNCRET.IMPLICIT  Non-void function implicitly returning int does not return value

17.5 Advisory No

 

17.6 Mandatory Yes

MISRA.FUNC.ARRAY.PARAM.STATIC.2012  The declaration of an array parameter shall not contain the static keyword between the []

17.7 Required Yes

MISRA.FUNC.UNUSEDRET.2012  The return value of a non-void function shall be used.

17.8 Advisory No

MISRA.FUNC.MODIFIEDPAR.2012  A function parameter should not be modified

18.1 Required No

ABV.GENERAL  Buffer Overflow - Array Index Out of Bounds

MISRA.PTR.ARITH.NOT_SAME.2012  A pointer resulting from arithmetic on a pointer operand shall address an element of the same array as that pointer operand

18.2 Required No

 

18.3 Required No

 

18.4 Advisory Yes

MISRA.PTR.ARITH.2012  Pointer is used in arithmetic expression

18.5 Advisory Yes

MISRA.PTR.TO_PTR_TO_PTR  Pointer declaration has more than two levels of indirection

18.6 Required No

LOCRET.ARG  Function returns address of local variable

LOCRET.GLOB  Function returns address of local variable

LOCRET.RET  Function returns address of local variable

18.7 Required Yes

MISRA.MEMB.FLEX_ARRAY.2012  Flexible array member shall not be declared

18.8 Required Yes

MISRA.ARRAY.VAR_LENGTH.2012  Variable-length array types shall not be used

19.1 Mandatory Yes

MISRA.ASSIGN.OVERLAP  Object is assigned to an overlapping object

19.2 Advisory Yes

MISRA.UNION  Union is used

20.1 Advisory Yes

MISRA.INCL.INSIDE  Include directive preceded by a preprocessor output token

20.2 Required Yes

MISRA.INCL.SYMS  Non-standard characters in header file names

20.3 Required Yes

MISRA.INCL.BAD  Non-standard include directive

20.4 Required Yes

MISRA.DEFINE.WRONGNAME.C99.2012  A macro shall not be defined with the same name as a keyword

20.5 Advisory Yes

MISRA.UNDEF  Undef usage

20.6 Required Yes

MISRA.EXPANSION.DIRECTIVE  Directive-like tokens within a macro argument

20.7 Required Yes

 

20.8 Required Yes

MISRA.ELIF.COND.NOT_BOOL.2012  #elif condition is not 0 or 1

MISRA.IF.COND.NOT_BOOL.2012  #if condition is not 0 or 1

20.9 Required Yes

MISRA.ELIF.UNDEF  Undefined macros in #elif directive

MISRA.IF.UNDEF  Undefined macros in #if directive

20.10 Advisory Yes

MISRA.DEFINE.SHARP  # or ## operator in a macro definition

20.11 Required Yes

MISRA.DEFINE.SHARP.ORDER.2012  Unspecified order of evaluation of multiple '#' or '##'

20.12 Required Yes

MISRA.DEFINE.SHARP.REPLACE.2012  A macro parameter used as an operand to the '#' or '##' operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators

20.13 Required Yes

MISRA.USE.UNKNOWNDIR  Unknown preprocessor directive is used

20.14 Required Yes

MISRA.ELIF.OTHERFILE  #elif in an improper file

MISRA.ELSE.OTHERFILE  #else in an improper file

MISRA.ENDIF.OTHERFILE  #endif in an improper file

21.1 Required Yes

MISRA.DEFINE.WRONGNAME  Usage of a name from the standard library for naming a macro

MISRA.DEFINE.WRONGNAME.UNDERSCORE  Usage of a reserved name for naming a macro

MISRA.UNDEF.WRONGNAME  Undefinition of a name from the standard library

MISRA.UNDEF.WRONGNAME.UNDERSCORE  Undefinition of a reserved name

21.2 Required Yes

MISRA.STDLIB.WRONGNAME  Reused name of standard library macro, object or function

MISRA.STDLIB.WRONGNAME.UNDERSCORE  Usage of a reserved name for naming a language entity

21.3 Required Yes

MISRA.STDLIB.MEMORY  Use of dynamic heap memory allocation

21.4 Required Yes

MISRA.STDLIB.LONGJMP  Use of setjmp macro or longjmp function

21.5 Required Yes

MISRA.INCL.SIGNAL.2012  The standard header file signal.h shall not be used

MISRA.STDLIB.SIGNAL  Use of the signal handling facilities of signal.h

21.6 Required Yes

MISRA.DEFINE.STDIO.WCHAR.2012  Inappropriate macro expansion

MISRA.INCL.STDIO.2012  The standard header files stdio.h shall not be used

MISRA.STDLIB.STDIO  Use of input/output library stdio.h in production code

MISRA.STDLIB.STDIO.WCHAR.2012  Wide-character equivalent identifiers from stdio.h shall not be used

21.7 Required Yes

MISRA.STDLIB.ATOI  Use of 'atof', 'atoi' or 'atol' from library stdlib.h

21.8 Required Yes

MISRA.STDLIB.ABORT.2012_AMD1  Use of 'abort', 'exit', or 'system' from library stdlib.h

21.9 Required Yes

MISRA.STDLIB.BSEARCH.2012  Use of 'bsearch' or 'qsort' from library stdlib.h

21.10 Required Yes

MISRA.DEFINE.WCSFTIME.2012  No macro with 'wcsftime' name shall be expanded

MISRA.INCL.TIME.2012  The standard header file time.h shall not be used

MISRA.STDLIB.TIME  Use of the time handling functions of library time.h

MISRA.STDLIB.WCSFTIME.2012  The identifier 'wcsftime' shall not be used

21.11 Required Yes

MISRA.INCL.TGMATH.2012  The standard header file tgmath.h shall not be used

21.12 Advisory Yes

MISRA.STDLIB.FENV.2012  Floating-point exception feature from fenv.h is used

MISRA.STDLIB.FENV.MACRO.2012  Floating-point exception feature from fenv.h is used

21.13 Mandatory No

MISRA.STDLIB.CTYPE.RANGE.2012_AMD1  Any value passed to a function in ctype.h shall be representable as an unsigned char or be the value EOF

21.14 Required No

 

21.15 Required Yes

MISRA.STDLIB.INCOMPAT_ARGS.2012_AMD1  The pointer arguments to memcpy, memmove, or memcmp are not pointers to compatible types

21.16 Required Yes

 

21.17 Mandatory No

ABV.ANY_SIZE_ARRAY  Buffer Overflow - Array Index Out of Bounds

ABV.GENERAL  Buffer Overflow - Array Index Out of Bounds

ABV.MEMBER  Buffer Overflow - Array Index Out of Bounds

ABV.STACK  Buffer Overflow - Local Array Index Out of Bounds

ABV.UNKNOWN_SIZE  Buffer Overflow - Array Index Out of Bounds

NNTS.MIGHT  Buffer Overflow - Non-null Terminated String

NNTS.MUST  Buffer Overflow - Non-null Terminated String

21.18 Mandatory No

ABV.ANY_SIZE_ARRAY  Buffer Overflow - Array Index Out of Bounds

ABV.GENERAL  Buffer Overflow - Array Index Out of Bounds

ABV.MEMBER  Buffer Overflow - Array Index Out of Bounds

ABV.STACK  Buffer Overflow - Local Array Index Out of Bounds

ABV.UNKNOWN_SIZE  Buffer Overflow - Array Index Out of Bounds

21.19 Mandatory No

MISRA.STDLIB.ILLEGAL_WRITE.2012_AMD1  The pointers returned by the Standard Library functions localeconv, getenv, setlocale or, strerror shall only be used as if they have pointer to const-qualified type

21.20 Mandatory No

MISRA.STDLIB.ILLEGAL_REUSE.2012_AMD1  The pointer returned by the Standard Library functions asctime and similar shall not be used following a subsequent call to the same function

21.21 Required Yes

MISRA.STDLIB.ABORT.2012_AMD1  Use of 'abort', 'exit', or 'system' from library stdlib.h

22.1 Required No

FREE.INCONSISTENT  Inconsistent Freeing of Memory

MLK.MIGHT  Memory Leak - possible

MLK.MUST  Memory Leak

MLK.RET.MIGHT  Memory Leak - possible

MLK.RET.MUST  Memory Leak

RH.LEAK  Resource leak

22.2 Mandatory No

FMM.MIGHT  Freeing Mismatched Memory - possible

FMM.MUST  Freeing Mismatched Memory

FNH.MIGHT  Freeing Non-Heap Memory - possible

FNH.MUST  Freeing Non-Heap Memory

FUM.GEN.MIGHT  Freeing Unallocated Memory - possible

FUM.GEN.MUST  Freeing Unallocated Memory

22.3 Required No

 

22.4 Mandatory No

MISRA.RESOURCES.FILE.READ_ONLY_WRITE.2012  There shall be no attempt to write to a stream which has been opened as read-only

22.5 Mandatory No

MISRA.FILE_PTR.DEREF.2012  A pointer to a FILE object shall not be dereferenced

MISRA.FILE_PTR.DEREF.CAST.2012  Object is casted to a FILE pointer, and it shall not be dereferenced

MISRA.FILE_PTR.DEREF.INDIRECT.2012  A pointer to a FILE object shall not be indirectly dereferenced by a system function

MISRA.FILE_PTR.DEREF.RETURN.2012  A pointer to a FILE object (returned by function) shall not be dereferenced

22.6 Mandatory No

MISRA.RESOURCES.FILE.USE_AFTER_CLOSE.2012  The value of a pointer to a FILE shall not be used after the associated stream has been closed

22.7 Required No

 

22.8 Required No

CXX.ERRNO.NOT_SET  Errno is not reset to zero before calling library function

22.9 Required No

CXX.ERRNO.NOT_CHECKED  Errno condition check is missing after calling library function

22.10 Required No

CXX.ERRNO.INCORRECTLY_CHECKED  Errno condition check not required after calling library function