Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1954?usp=email
to review the following change.
Change subject: Fix various issues found by cppcheck 2.21.0
......................................................................
Fix various issues found by cppcheck 2.21.0
- Fix several constVariablePointer issues that
were newly reported
- Fix one unreadVariable issue that was newly
reported
- Remove --showtime=summary from cppcheck args
again, it is now much more verbose
Change-Id: I6693b5aa2988102f5e7884a65119ebfc87dd07e1
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M dev-tools/run-cppcheck.sh
M src/openvpn/dco.c
M src/openvpn/mudp.c
M src/openvpn/pkcs11_openssl.c
M src/openvpn/socks.c
M tests/unit_tests/openvpn/siphash_openssl.c
6 files changed, 5 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/54/1954/1
diff --git a/dev-tools/run-cppcheck.sh b/dev-tools/run-cppcheck.sh
index 4c4ba2c..6b2c2be 100755
--- a/dev-tools/run-cppcheck.sh
+++ b/dev-tools/run-cppcheck.sh
@@ -33,7 +33,7 @@
--suppress-xml=${SCRIPT_DIR}/cppcheck-suppressions.xml --inline-suppr \
--cppcheck-build-dir=${CPPCHECK_DIR} \
--check-level=${CPPCHECK_CHECK_LEVEL} --max-configs=10 \
- --error-exitcode=1 --showtime=summary"
+ --error-exitcode=1"
set -x
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index 8eae4bf..7864e21 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -534,7 +534,7 @@
ASSERT(sock->info.connection_established);
struct sockaddr *remoteaddr = &sock->info.lsa->actual.dest.addr.sa;
- struct tls_multi *multi = c->c2.tls_multi;
+ const struct tls_multi *multi = c->c2.tls_multi;
#ifdef TARGET_FREEBSD
/* In Linux in P2P mode the kernel automatically removes an existing peer
* when adding a new peer. FreeBSD needs to explicitly be told to do that
*/
diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
index 4794b7e..2b08ada 100644
--- a/src/openvpn/mudp.c
+++ b/src/openvpn/mudp.c
@@ -316,10 +316,9 @@
multi_get_instance_udp_real(struct multi_context *m, struct mroute_addr *real)
{
struct hash *hash = m->hash;
- struct hash_element *he;
const uint64_t hv = hash_value(hash, real);
struct hash_bucket *bucket = hash_bucket(hash, hv);
- he = hash_lookup_fast(hash, bucket, real, hv);
+ const struct hash_element *he = hash_lookup_fast(hash, bucket, real, hv);
if (he)
{
return he->value;
diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c
index 69c5a50..24dce84 100644
--- a/src/openvpn/pkcs11_openssl.c
+++ b/src/openvpn/pkcs11_openssl.c
@@ -184,7 +184,6 @@
{
tbs = buf;
tbslen = (size_t)buflen;
- sigalg.op = "Sign";
}
else
{
diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
index 19f3d54..65ecb3c 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -323,8 +323,7 @@
return port;
}
- struct servent *service;
- service = getservbyname(servname, NULL);
+ const struct servent *service = getservbyname(servname, NULL);
if (service)
{
return service->s_port;
diff --git a/tests/unit_tests/openvpn/siphash_openssl.c
b/tests/unit_tests/openvpn/siphash_openssl.c
index c301f2d..99a7763 100644
--- a/tests/unit_tests/openvpn/siphash_openssl.c
+++ b/tests/unit_tests/openvpn/siphash_openssl.c
@@ -101,7 +101,7 @@
bool
siphash_openssl_available(void *sip_context)
{
- struct siphash_context *sip = sip_context;
+ const struct siphash_context *sip = sip_context;
return (bool)(sip->mac);
}
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1954?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6693b5aa2988102f5e7884a65119ebfc87dd07e1
Gerrit-Change-Number: 1954
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel