summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2020-03-19 15:18:46 -0400
committerPaul Moore <paul@paul-moore.com>2020-03-19 16:14:21 -0400
commit4f17cc4d2c74da99ccd619d2e9c8f41ac6ba2e2c (patch)
treea38542826ba77fa87b743569f4bda33ed82fce68
parent60ee8da07e42edbf22a5ecb0e258e04304b397fb (diff)
downloadlibseccomp-4f17cc4d2c74da99ccd619d2e9c8f41ac6ba2e2c.tar.gz
all: fix all the outstanding lgtm.com alerts
There are no functional changes in this patch, just some minor changes found by the lgtm.com service: * four functions in tools/util.c were "hiding" a global variable with a local variable ("arch") * src/arch.c had an unnecessary check in an if-condition Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--src/arch.c6
-rw-r--r--tools/util.c24
2 files changed, 15 insertions, 15 deletions
diff --git a/src/arch.c b/src/arch.c
index 83c2c9b..361afe7 100644
--- a/src/arch.c
+++ b/src/arch.c
@@ -374,10 +374,10 @@ int arch_syscall_rewrite(const struct arch_def *arch, int *syscall)
if (sys >= -1) {
/* we shouldn't be here - no rewrite needed */
return 0;
- } else if (sys < -1 && sys > -100) {
- /* reserved values */
+ } else if (sys > -100) {
+ /* -2 to -99 are reserved values */
return -EINVAL;
- } else if (sys <= -100 && sys > -10000) {
+ } else if (sys > -10000) {
/* rewritable syscalls */
if (arch->syscall_rewrite)
(*arch->syscall_rewrite)(syscall);
diff --git a/tools/util.c b/tools/util.c
index 741b2a2..5687b30 100644
--- a/tools/util.c
+++ b/tools/util.c
@@ -89,15 +89,15 @@ uint32_t arch = ARCH_NATIVE;
/**
* Convert a 16-bit target integer into the host's endianess
- * @param arch the architecture token
+ * @param arch_token the architecture token
* @param val the 16-bit integer
*
* Convert the endianess of the supplied value and return it to the caller.
*
*/
-uint16_t ttoh16(uint32_t arch, uint16_t val)
+uint16_t ttoh16(uint32_t arch_token, uint16_t val)
{
- if (arch & __AUDIT_ARCH_LE)
+ if (arch_token & __AUDIT_ARCH_LE)
return le16toh(val);
else
return be16toh(val);
@@ -105,15 +105,15 @@ uint16_t ttoh16(uint32_t arch, uint16_t val)
/**
* Convert a 32-bit target integer into the host's endianess
- * @param arch the architecture token
+ * @param arch_token the architecture token
* @param val the 32-bit integer
*
* Convert the endianess of the supplied value and return it to the caller.
*
*/
-uint32_t ttoh32(uint32_t arch, uint32_t val)
+uint32_t ttoh32(uint32_t arch_token, uint32_t val)
{
- if (arch & __AUDIT_ARCH_LE)
+ if (arch_token & __AUDIT_ARCH_LE)
return le32toh(val);
else
return be32toh(val);
@@ -121,15 +121,15 @@ uint32_t ttoh32(uint32_t arch, uint32_t val)
/**
* Convert a 32-bit host integer into the target's endianess
- * @param arch the architecture token
+ * @param arch_token the architecture token
* @param val the 32-bit integer
*
* Convert the endianess of the supplied value and return it to the caller.
*
*/
-uint32_t htot32(uint32_t arch, uint32_t val)
+uint32_t htot32(uint32_t arch_token, uint32_t val)
{
- if (arch & __AUDIT_ARCH_LE)
+ if (arch_token & __AUDIT_ARCH_LE)
return htole32(val);
else
return htobe32(val);
@@ -137,15 +137,15 @@ uint32_t htot32(uint32_t arch, uint32_t val)
/**
* Convert a 64-bit host integer into the target's endianess
- * @param arch the architecture token
+ * @param arch_token the architecture token
* @param val the 64-bit integer
*
* Convert the endianess of the supplied value and return it to the caller.
*
*/
-uint64_t htot64(uint32_t arch, uint64_t val)
+uint64_t htot64(uint32_t arch_token, uint64_t val)
{
- if (arch & __AUDIT_ARCH_LE)
+ if (arch_token & __AUDIT_ARCH_LE)
return htole64(val);
else
return htobe64(val);