examples: remove unneeded atomic header include
[dpdk.git] / examples / vm_power_manager / channel_manager.c
index 4d13697..838465a 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/un.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <rte_memory.h>
 #include <rte_mempool.h>
 #include <rte_log.h>
-#include <rte_atomic.h>
 #include <rte_spinlock.h>
 
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
@@ -468,9 +465,15 @@ add_all_channels(const char *vm_name)
                        continue;
                }
 
-               snprintf(chan_info->channel_path,
+               if ((size_t)snprintf(chan_info->channel_path,
                                sizeof(chan_info->channel_path), "%s%s",
-                               CHANNEL_MGR_SOCKET_PATH, dir->d_name);
+                               CHANNEL_MGR_SOCKET_PATH, dir->d_name)
+                                       >= sizeof(chan_info->channel_path)) {
+                       RTE_LOG(ERR, CHANNEL_MANAGER, "Pathname too long for channel '%s%s'\n",
+                                       CHANNEL_MGR_SOCKET_PATH, dir->d_name);
+                       rte_free(chan_info);
+                       continue;
+               }
 
                if (setup_channel_info(&vm_info, &chan_info, channel_num) < 0) {
                        rte_free(chan_info);
@@ -507,7 +510,6 @@ add_channels(const char *vm_name, unsigned *channel_list,
        }
 
        for (i = 0; i < len_channel_list; i++) {
-
                if (channel_list[i] >= RTE_MAX_LCORE) {
                        RTE_LOG(INFO, CHANNEL_MANAGER, "Channel(%u) is out of range "
                                                        "0...%d\n", channel_list[i],
@@ -569,6 +571,9 @@ add_host_channels(void)
        }
 
        for (i = 0; i < ci->core_count; i++) {
+               if (rte_lcore_index(i) == -1)
+                       continue;
+
                if (ci->cd[i].global_enabled_cpus == 0)
                        continue;