CWARN.PASSBYVALUE.ARG

Function argument passed by value is too large

The CWARN.PASSBYVALUE.ARG checker finds instances in which a function argument passed by value is too large.

Vulnerability and risk

Passing by value is not necessarily an error, but it can cause a performance loss because of the amount of data copied.

Vulnerable code example

Copy
  struct strcture{
    int x[20];
    char y[100];
    int z[20];
  };
  
  void foo(strcture arg) 
  {}

Klocwork flags line 7, in which the argument arg is too large.

Related checkers