You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by Ivan Zhakov <iv...@visualsvn.com> on 2016/08/01 10:05:23 UTC
Re: static code analysis from a user
On 29 July 2016 at 11:23, Andreas Stieger <An...@gmx.de> wrote:
> Hello,
>
> I wanted to share the output of a static code analysis tool that a user mentioned on IRC.
>
> Philipp claimed that these were found using cppcheck, version 1.75 dev, with with --inconclusive --enable=all
> http://cppcheck.sourceforge.net/
>
Thanks for posting this to dev@ list.
> From http://codepad.org/2oAAx6OX
>
> [F:\serf\auth\auth.c:219]: (style) The scope of the variable 'hdrs' can be reduced.
Fixed in r1754719.
> [F:\serf\auth\auth_digest.c:290]: (style) Redundant condition: If 'EXPR == ' '', the comparison 'EXPR' is always true.
Fixed in r1754720.
> [F:\serf\auth\auth_spnego.c:476] -> [F:\serf\auth\auth_spnego.c:458]: (warning) Either the
> condition 'gss_info' is redundant or there is possible null pointer dereference: gss_info.
This could be real problem and needs more to time to investigate.
> [F:\serf\auth\auth_spnego_gss.c:71]: (style) Variable 'maj_stat' is assigned a value that is never used.
> [F:\serf\auth\auth_digest.c:507]: (style) Redundant condition: If 'EXPR == ' '', the comparison 'EXPR' is always true.
Fixed 1754722.
> [F:\serf\buckets\aggregate_buckets.c:504]: (style) The scope of the variable 'found_bucket' can be reduced.
Fixed in r1754719.
> [F:\serf\buckets\chunk_buckets.c:66]: (style) The scope of the variable 'simple_bkt' can be reduced.
Fixed in r1754719.
> [F:\serf\buckets\fcgi_buckets.c:513]: (style) The scope of the variable 'tmp' can be reduced.
Fixed in r1754719.
> [F:\serf\buckets\hpack_buckets.c:1479]: (style) Variable 'status' is assigned a value that is never used.
> [F:\serf\protocols\fcgi_protocol.c:65]: (warning) Redundant assignment of 'fcgi' to itself.
> [F:\serf\protocols\fcgi_protocol.c:65]: (style) Variable 'fcgi' is assigned a value that is never used.
> [F:\serf\buckets\ssl_buckets.c:2469] -> [F:\serf\buckets\ssl_buckets.c:2475]: (warning) Either the condition 'if(ssl_ctx)' is redundant or there is possible null pointer dereference: ssl_ctx.
> [F:\serf\buckets\ssl_buckets.c:2472] -> [F:\serf\buckets\ssl_buckets.c:2475]: (warning) Either the condition 'if(ssl_ctx)' is redundant or there is possible null pointer dereference: ssl_ctx.
This needs more investigation.
> [F:\serf\buckets\ssl_buckets.c:738]: (style) The scope of the variable 'buf' can be reduced.
Fixed in r1754719.
> [F:\serf\buckets\ssl_buckets.c:739]: (style) The scope of the variable 'length' can be reduced.
> [F:\serf\buckets\ssl_buckets.c:1835]: (style) Variable 'raw_header' is assigned a value that is never used.
> [F:\serf\src\logging.c:109]: (style) The scope of the variable 'argp' can be reduced.
Fixed in r1754719.
> [F:\serf\src\logging.c:141]: (style) The scope of the variable 'argp' can be reduced.
Fixed in r1754719.
> [F:\serf\src\outgoing.c:75]: (style) Redundant condition: !conn.pipelining. 'A || (!A && B)' is equivalent to 'A || B'
> [F:\serf\test\CuTest.c:388]: (style) The scope of the variable 'i' can be reduced.
Fixed in r1754719.
> [F:\serf\test\CuTest.c:389]: (style) The scope of the variable 'failCount' can be reduced.
Fixed in r1754719.
> [F:\serf\test\CuTest.c:167]: (error, inconclusive) Address of local auto-variable assigned to a function parameter.
As far I understand this is normal usage of setjmp().
> [F:\serf\test\serf_get.c:869]: (style) The scope of the variable 'buf' can be reduced.
> [F:\serf\test\serf_httpd.c:489]: (style) The scope of the variable 'buf' can be reduced.
> [F:\serf\test\serf_response.c:82]: (style) The scope of the variable 's' can be reduced.
I didn't fix these yet.
--
Ivan Zhakov