Main Content

Check configuration parameters for secure coding standards

Check ID: mathworks.security.CodeGenSettings

Identify configuration parameters that might impact compliance with secure coding standards.

Description

Following the recommendations of this check increases the likelihood of generating code that complies with CERT C, CWE, ISO/IEC TS 17961 secure coding standards.

Available with Embedded Coder® and Simulink® Check™.

Results and Recommended Actions

ConditionRecommended Action
Diagnostics

Configuration parameter Inf or NaN block output is set to None or error and Support non-finite numbers is set to on.

Configuration parameter Inf or NaN block output is set to None and Support non-finite numbers is set to off.

When Support non-finite numbers is:

  • on, set Inf or NaN block output to warning.

  • off, set Inf or NaN block output to warning or error.

Configuration parameter Model Verification block enabling is set to Use local settings or Enable All.Set Model Verification block enabling to Disable All.
Configuration parameter Undirected event broadcasts is set to none or warning.Set Undirected event broadcasts to error.
Configuration parameter Wrap on overflow is set to none.Set Wrap on overflow to warning or error.
Hardware Implementation
Configuration parameter Production hardware signed integer division rounds to is set to Undefined.Set Production hardware signed integer division rounds to to Zero or Floor.
Configuration parameter Shift right on a signed integer as arithmetic shift is selected.Clear Shift right on a signed integer as arithmetic shift.
Simulation Target
Configuration parameter Compile-time recursion limit for MATLAB functions is set to a value other than 0.Set Compile-time recursion limit for MATLAB functions to 0.
Configuration parameter Dynamic memory allocation in MATLAB functions is selected.Clear Dynamic memory allocation in MATLAB functions.
Configuration parameter Enable run-time recursion for MATLAB functions is selected.Clear Enable run-time recursion for MATLAB functions.
Code Generation
Configuration parameter Code replacement library is not set to None or AUTOSAR 4.0.Set Code replacement library to None or AUTOSAR 4.0.
Configuration parameter External mode is selected.Clear External mode.

Configuration parameter Include comments is cleared.

Select Include comments.
Configuration parameter MAT-file logging is selected.Clear MAT-file logging.
For ERT-based target systems, configuration parameter MATLAB user comments is cleared.Select MATLAB user comments.
Configuration parameter Replace multiplications by powers of two with signed bitwise shifts is selected.Clear Replace multiplications by powers of two with signed bitwise shifts.
For ERT-based target systems, configuration parameter Support continuous time is selected Clear Support continuous time.
For ERT-based target systems, configuration parameter Support non-inlined S-functions is selected Clear Support non-inlined S-functions.
Configuration parameter System target file is set to a GRT-based target.Set System target file to an ERT-based target.
Configuration parameter Use dynamic memory allocation for model initialization is selected.Clear Use dynamic memory allocation for model initialization.

Note

Select only when Code Interface Packaging is set to Reusable Function.

Action Results

Clicking Modify All changes the parameter values to the recommended values.

Note

When you click Modify All for models with a GRT-based target, the Model Advisor does not update the System target file configuration parameter to an ERT-based system.

Parameter subchecks depend on the results of the parameter noted with D in the results table. When the result is D-Warning, the Current Value column in the results table states Prerequisite constraint not met for the subchecks. After you change the parameter, rerun the check.

Note

Some subchecks are specific to configuration parameters for ERT-based systems. These parameters are not updated when you click Modify All unless you change the model to an ERT-based system.

See Also

MISRA C (Embedded Coder)