fix compiler warnings on x86 and staic code analysis

This commit is contained in:
Amin Ben Ramdhane 2021-01-25 18:56:05 +01:00
parent e240579676
commit dd08e11ee1
3 changed files with 8 additions and 19 deletions

View file

@ -2405,7 +2405,7 @@ static int get_BridgingBridgePort_PVID(char *refparam, struct dmctx *ctx, void *
static int fetch_and_configure_inner_vid(char *br_inst, char *type_val, char **vid) {
struct uci_section *dev_s = NULL, *sec = NULL;
char *name, *instance;
char *name, *instance = NULL;
// Get the vid under device section with type 8021q of port under same br_inst.
uci_foreach_option_eq("network", "device", "type", type_val, dev_s) {
@ -2417,10 +2417,8 @@ static int fetch_and_configure_inner_vid(char *br_inst, char *type_val, char **v
}
//Check if the bridge instances are same or not, if yes, then get the vid.
char bridge_inst[20] = {0};
strncpy(bridge_inst, br_inst, sizeof(bridge_inst));
if (strncmp(bridge_inst, instance, sizeof(bridge_inst)) == 0) {
if (strcmp(type_val, "8021ad") == 0) {
if (instance && br_inst && strcmp(br_inst, instance) == 0) {
if (type_val && strcmp(type_val, "8021ad") == 0) {
dmuci_set_value_by_section(dev_s, "inner_vid", *vid);
} else {
dmuci_get_value_by_section_string(dev_s, "vid", vid);

View file

@ -81,7 +81,7 @@ static void create_firewall_zone_config(char *iface)
dmuci_set_value_by_section(s, "network", iface);
}
static int parse_proc_intf6_line(const char *line, const char *device, char *ipstr)
static int parse_proc_intf6_line(const char *line, const char *device, char *ipstr, size_t str_len)
{
char ip6buf[INET6_ADDRSTRLEN] = {0}, dev[32] = {0};
unsigned int ip[4], prefix;
@ -99,7 +99,7 @@ static int parse_proc_intf6_line(const char *line, const char *device, char *ips
ip[3] = htonl(ip[3]);
inet_ntop(AF_INET6, ip, ip6buf, INET6_ADDRSTRLEN);
snprintf(ipstr, INET6_ADDRSTRLEN, "%s/%u", ip6buf, prefix);
snprintf(ipstr, str_len, "%s/%u", ip6buf, prefix);
if (strncmp(ipstr, "fe80:", 5) != 0)
return -1;
@ -127,7 +127,7 @@ static bool proc_intf6_line_exists(char *parent_section, char *address)
static void dmmap_synchronize_ipv6_address_link_local(char *parent_section)
{
struct uci_section *s = NULL, *stmp = NULL;
char buf[512] = {0}, ipstr[INET6_ADDRSTRLEN] = {0};
char buf[512] = {0}, ipstr[64] = {0};
FILE *fp = NULL;
char *device = get_device(parent_section);
@ -151,7 +151,7 @@ static void dmmap_synchronize_ipv6_address_link_local(char *parent_section)
bool found = false;
while (fgets(buf, 512, fp) != NULL) {
if (parse_proc_intf6_line(buf, device, ipstr))
if (parse_proc_intf6_line(buf, device, ipstr, sizeof(ipstr)))
continue;
if (address && strcmp(address, ipstr) == 0) {
@ -171,7 +171,7 @@ static void dmmap_synchronize_ipv6_address_link_local(char *parent_section)
while (fgets(buf , 512 , fp) != NULL) {
if (parse_proc_intf6_line(buf, device, ipstr))
if (parse_proc_intf6_line(buf, device, ipstr, sizeof(ipstr)))
continue;
if (proc_intf6_line_exists(parent_section, ipstr))

View file

@ -1554,20 +1554,11 @@ static int get_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dm
static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *supported_modes = NULL;
switch (action) {
case VALUECHECK:
if (dm_validate_string(value, -1, -1, NULL, 0, NULL, 0))
return FAULT_9007;
// Get the list of all supported security modes
get_access_point_security_supported_modes(refparam, ctx, data, instance, &supported_modes);
// Check if the input value is a valid security mode
if (supported_modes && strstr(supported_modes, value) == NULL)
return FAULT_9007;
return 0;
case VALUESET:
set_security_mode((struct uci_section *)data, value);