From 3b36725308db8eef19819d56ffcd32cf0f284da0 Mon Sep 17 00:00:00 2001
From: Rahul Thakur <rahul.thakur@iopsys.eu>
Date: Thu, 16 Nov 2023 14:47:03 +0530
Subject: [PATCH] fix pipeline

---
 .gitlab-ci.yml                    |  6 +++---
 bcm/bcm.c                         |  2 +-
 econet/ecnt_prvt.c                |  2 +-
 gitlab-ci/install-dependencies.sh | 22 ++++------------------
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4a08067..c9c2ba4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 include:
   - project: 'iopsys/gitlab-ci-pipeline'
     file: '/static-code-analysis.yml'
-    ref: '0.28'
+    ref: '0.31'
 
 stages:
     - static_code_analysis
@@ -13,11 +13,11 @@ stages:
 variables:
   DEBUG: 'TRUE'
   SOURCE_FOLDER: "."
-  RUN_CPPCHECK: "cppcheck --enable=all --error-exitcode=1 --suppress=missingInclude --suppress=unusedFunction --suppress=unreadVariable --suppress=variableScope --suppress=redundantInitialization --suppress=unusedLabel --suppress=unusedStructMember --suppress=knownConditionTrueFalse --suppress=unmatchedSuppression -i test_stub/"
+  CPPCHECK_OPTIONS: "--enable=all --error-exitcode=1 --suppress=missingInclude --suppress=unusedFunction --suppress=unreadVariable --suppress=variableScope --suppress=redundantInitialization --suppress=unusedLabel --suppress=unusedStructMember --suppress=knownConditionTrueFalse --suppress=unmatchedSuppression -i test_stub/"
 
 run_compile_test:
     stage: compile_test
-    image: ${COMMON_IMAGE}
+    image: dev.iopsys.eu:5050/iopsys/gitlab-ci-pipeline/code-analysis
     allow_failure: false
     script:
         - "./gitlab-ci/install-dependencies.sh"
diff --git a/bcm/bcm.c b/bcm/bcm.c
index d8edf2f..006c53a 100644
--- a/bcm/bcm.c
+++ b/bcm/bcm.c
@@ -245,7 +245,7 @@ static int bcm_eth_get_stats_from_proc(const char *ifname, struct eth_stats *s)
 		return -1;
 
 	ptr = cmdbuf + strlen(ifname) + strlen(":");
-	ret = sscanf(ptr,
+	ret = sscanf(ptr, /* Flawfinder: ignore */
 		" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
 		" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
 		" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
diff --git a/econet/ecnt_prvt.c b/econet/ecnt_prvt.c
index d47416e..735ae84 100644
--- a/econet/ecnt_prvt.c
+++ b/econet/ecnt_prvt.c
@@ -89,7 +89,7 @@ static int get_drv_info_by_ifname(char *ifname, char *buffer)
 	if (ioctl(fd, SIOCETHTOOL, &ifr) != 0)
 		goto exit;
 
-	strcpy(buffer, info.driver);
+	strncpy(buffer, info.driver, DRIVER_NAME_LEN - 1);
 	ret = 0;
 
 exit:
diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh
index f86d6b6..68d5d98 100755
--- a/gitlab-ci/install-dependencies.sh
+++ b/gitlab-ci/install-dependencies.sh
@@ -2,25 +2,11 @@
 
 echo "install dependencies"
 
-home=$(pwd)
-
-function exec_cmd()
-{
-	echo "executing $@"
-	$@ >/dev/null 2>&1
-	local ret=$?
-
-	if [ "${ret}" -ne 0 ]; then
-		echo "Failed to execute $@ ret (${ret})"
-		exit 1
-	fi
-}
-
 # libeasy.so
 rm -fr libeasy
 mkdir -p /usr/include/easy
-exec_cmd git clone -b devel https://dev.iopsys.eu/hal/libeasy.git
+git clone -b devel https://dev.iopsys.eu/hal/libeasy.git
 cd libeasy
-exec_cmd make CFLAGS+="-I/usr/include/libnl3"
-exec_cmd cp -a libeasy*.so* /usr/lib
-exec_cmd cp -a easy.h event.h utils.h if_utils.h debug.h hlist.h /usr/include/easy/
+make
+cp -a libeasy*.so* /usr/lib
+cp -a *.h /usr/include/easy/
-- 
GitLab