[qca-ssdk-shell] fix  KW error

fix  KW error

Change-Id: I413fcd21d54280c6b45fc5e9f770e597ace73287
Signed-off-by: slv <slv@codeaurora.org>
diff --git a/src/shell/shell.c b/src/shell/shell.c
index 997e3b4..b2e66dd 100755
--- a/src/shell/shell.c
+++ b/src/shell/shell.c
@@ -88,7 +88,7 @@
     a_int16_t i;
     a_uint32_t *pbuf;
     a_uint16_t rtn_size = 1;
-    sw_api_param_t *pptmp;
+    sw_api_param_t *pptmp = pp;
 
     pbuf = ioctl_buf + rtn_size;    /*reserve for return value */
 
@@ -530,7 +530,7 @@
 cmd_exec(a_uint32_t *arg_val, int cmd_index, int cmd_index_sub)
 {
     a_uint32_t api_id = arg_val[0];
-    sw_error_t rtn;
+    sw_error_t rtn = SW_OK;
 
     if( api_id < SW_API_MAX )
     {
diff --git a/src/shell/shell_io.c b/src/shell/shell_io.c
index 02a07a2..554c226 100755
--- a/src/shell/shell_io.c
+++ b/src/shell/shell_io.c
@@ -1050,7 +1050,7 @@
     char *cmd;
     sw_error_t rv;
     fal_vlan_t entry;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
 
     memset(&entry, 0, sizeof (fal_vlan_t));
 
@@ -2014,7 +2014,7 @@
     char *cmd;
     sw_error_t rv;
     fal_fdb_entry_t entry;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
 
     memset(&entry, 0, sizeof (fal_fdb_entry_t));
 
@@ -3070,7 +3070,7 @@
 cmd_data_check_mac_field(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     /* get destination mac address field configuration */
     cmd_data_check_element("mac dst addr field", "no", "usage: <yes/no/y/n>\n",
@@ -3504,7 +3504,7 @@
 cmd_data_check_ip4_field(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     /* get ip4 source address field configuration */
     cmd_data_check_element("ip4 src address field", "no",
@@ -3599,7 +3599,7 @@
 cmd_data_check_ip6_field(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     /* get ip6 source address field configuration */
     cmd_data_check_element("ip6 src address field", "no",
@@ -3696,7 +3696,7 @@
 cmd_data_check_ip_field(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     /* get ip protocol field configuration */
     cmd_data_check_element("ip protocol field", "no", "usage: <yes/no/y/n>\n",
@@ -4067,7 +4067,7 @@
 cmd_data_check_udf_field(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata, vlen, mlen;
+    a_uint32_t tmpdata = 0, vlen = 0, mlen = 0;
 
     /* get udf field configuration */
     cmd_data_check_element("user define field", "no",
@@ -4111,7 +4111,7 @@
 cmd_data_check_acl_action(fal_acl_rule_t * entry)
 {
     char *cmd;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     /* get permit action configuration */
     cmd_data_check_element("permit", "yes", "usage: <yes/no/y/n>\n",
@@ -4469,7 +4469,7 @@
     char *cmd;
     sw_error_t rv;
     fal_acl_rule_t entry;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     memset(&entry, 0, sizeof (fal_acl_rule_t));
 
@@ -5082,7 +5082,7 @@
 {
     char *cmd;
     led_ctrl_pattern_t pattern;
-    a_uint32_t tmpdata;
+    a_uint32_t tmpdata = 0;
 
     memset(&pattern, 0, sizeof (led_ctrl_pattern_t));
 
@@ -6704,7 +6704,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
     fal_nat_entry_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_nat_entry_t));
@@ -7037,7 +7037,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
     fal_napt_entry_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_napt_entry_t));
@@ -7524,7 +7524,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
     fal_napt_entry_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_napt_entry_t));
@@ -8002,7 +8002,7 @@
 cmd_data_check_intf_mac_entry(char *cmd_str, void * val, a_uint32_t size)
 {
     char *cmd;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
     sw_error_t rv;
     fal_intf_mac_entry_t entry;
 
@@ -8252,7 +8252,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_bool_t bool;
+    a_bool_t bool = A_FALSE;
     fal_egress_shaper_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_egress_shaper_t));
@@ -8462,7 +8462,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_bool_t bool;
+    a_bool_t bool = A_FALSE;
     fal_acl_policer_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_acl_policer_t));
@@ -8802,7 +8802,7 @@
 {
     char *cmd;
     sw_error_t rv;
-    a_bool_t bool;
+    a_bool_t bool = A_FALSE;
     fal_port_policer_t entry;
 
     aos_mem_zero(&entry, sizeof (fal_port_policer_t));
@@ -10189,7 +10189,7 @@
     char *cmd;
     sw_error_t rv;
     fal_egress_remark_table_t *pEntry = (fal_egress_remark_table_t *)val;
-    a_uint32_t tmp;
+    a_uint32_t tmp = 0;
 
     memset(pEntry, 0, sizeof(fal_egress_remark_table_t));
 
@@ -10504,7 +10504,7 @@
     sw_error_t rv;
     fal_default_route_t entry;
 
-    aos_mem_zero(&entry, sizeof (fal_intf_mac_entry_t));
+    aos_mem_zero(&entry, sizeof (fal_default_route_t));
 
     do
     {
diff --git a/src/shell/shell_lib.c b/src/shell/shell_lib.c
index e7f00e4..e1eff71 100755
--- a/src/shell/shell_lib.c
+++ b/src/shell/shell_lib.c
@@ -586,9 +586,10 @@
 
     memset(matchBuf, 0, MATCH_BUF_MAX);
 
-	if(cmd_cursor < MATCH_BUF_MAX)
+	if(cmd_cursor < MATCH_BUF_MAX) {
 		strncpy(matchBuf, cmd_strp, cmd_cursor);
-	else {
+		matchBuf[cmd_cursor] = '\0';
+	} else {
 		strncpy(matchBuf, cmd_strp, MATCH_BUF_MAX-1);
 		matchBuf[MATCH_BUF_MAX-1] = '\0';
 	}