X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fchannel_manager.c;h=838465ab4b1848e2158e94421cb5c943f66aa54a;hb=69a3c6319140b34fb714fa5bd6990cceb2ea2997;hp=4d136972089afcf928a4352afad6c67a41f2062d;hpb=96d3d532f9f2e42cf8b620ad3ba9da1f04ccb3f0;p=dpdk.git diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 4d13697208..838465ab4b 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -4,7 +4,6 @@ #include #include -#include #include #include #include @@ -22,13 +21,11 @@ #include #include #include -#include #include #include #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;