mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Static analysis improvements
This commit is contained in:
parent
785f76f595
commit
f88bf094f9
26 changed files with 5 additions and 238 deletions
|
|
@ -6,13 +6,13 @@ variables:
|
|||
DEBUG: 'TRUE'
|
||||
SOURCE_FOLDER: "."
|
||||
COMMON_IMAGE: iopsys/code-analysis:0.27
|
||||
RUN_CPPCHECK: "cppcheck --enable=style --error-exitcode=1 --inline-suppr --include=/usr/local/include/json-c/json_object.h --include=/usr/include/libubox/list.h -I . -I ./include/ -I ./libbbf_api/ -i test/ -DBBF_VENDOR_IOPSYS -DBBF_VENDOR_OPENWRT"
|
||||
RUN_CPPCHECK: "cppcheck --enable=information --error-exitcode=1 -DBBFDM_ENABLE_DOTSO_PLUGIN -DBBFDM_ENABLE_DOTSO_PLUGIN -DBBF_TR181 -DBBF_VENDOR_IOPSYS -DBBF_VENDOR_OPENWRT --inline-suppr -i test/"
|
||||
|
||||
stages:
|
||||
- static_code_analysis
|
||||
- unit_test
|
||||
- functional_test
|
||||
- memory_test
|
||||
- functional_test
|
||||
- uspd
|
||||
|
||||
run_unit_test:
|
||||
|
|
|
|||
|
|
@ -79,10 +79,6 @@ static void free_json_data(struct list_head *json_list)
|
|||
struct dm_json_obj *dm_json_obj = NULL;
|
||||
|
||||
while (json_list->next != json_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dm_json_obj = list_entry(json_list->next, struct dm_json_obj, list);
|
||||
list_del(&dm_json_obj->list);
|
||||
dmfree(dm_json_obj->name);
|
||||
|
|
@ -104,10 +100,6 @@ static void free_loaded_json_files(struct list_head *json_list)
|
|||
{
|
||||
struct loaded_json_file *json_file;
|
||||
while (json_list->next != json_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
json_file = list_entry(json_list->next, struct loaded_json_file, list);
|
||||
list_del(&json_file->list);
|
||||
if (json_file->data)
|
||||
|
|
@ -784,10 +776,6 @@ static char *uci_v1_get_value(json_object *mapping_obj, char *refparam, struct d
|
|||
json_object_object_get_ex(mapping_obj, "data", &data_s);
|
||||
json_object_object_get_ex(mapping_obj, "key", &key);
|
||||
|
||||
/* json_object_object_get_ex is an external macro which changes the
|
||||
* value of data_s that cppcheck can't track and throws warning as
|
||||
* data_s value check always true. So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (data == NULL || data_s == NULL || (data_s && strcmp(json_object_get_string(data_s), "@Parent") != 0))
|
||||
goto end;
|
||||
|
||||
|
|
@ -813,10 +801,6 @@ static char *ubus_v1_get_value(json_object *mapping_obj, char *refparam, struct
|
|||
json_object_object_get_ex(mapping_obj, "data", &data_json);
|
||||
json_object_object_get_ex(mapping_obj, "key", &key);
|
||||
|
||||
/* json_object_object_get_ex is an external macro which changes the
|
||||
* value of data_json that cppcheck can't track and throws warning as
|
||||
* data_json value check always true. So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (data == NULL || data_json == NULL || (data_json && strcmp(json_object_get_string(data_json), "@Parent") != 0))
|
||||
goto end;
|
||||
|
||||
|
|
@ -1110,10 +1094,6 @@ static int fill_string_arguments(struct json_object *json_obj, int *min_length,
|
|||
|
||||
json_object_object_get_ex(json_obj, "pattern", &pattern_obj);
|
||||
if ((pattern_obj != NULL) && json_object_get_type(pattern_obj) == json_type_array) {
|
||||
/* json_object_object_get_ex is an external macro which changes the
|
||||
* value of pattern_obj that cppcheck can't track and throws warning as
|
||||
* pattern_obj value check always true. So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
int pattern_len = (pattern_obj) ? json_object_array_length(pattern_obj) + 1 : 1;
|
||||
|
||||
for (int i = 0; i < pattern_len - 1; i++) {
|
||||
|
|
@ -1389,10 +1369,6 @@ static void uci_v1_set_value(json_object *mapping_obj, int json_version, char *r
|
|||
json_object_object_get_ex(mapping_obj, "data", &data_s);
|
||||
json_object_object_get_ex(mapping_obj, "key", &key);
|
||||
|
||||
/* json_object_object_get_ex is an external macro which changes the
|
||||
* value of data_s that cppcheck can't track and throws warning as
|
||||
* data_s value check always true. So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (data == NULL || data_s == NULL || (data_s && strcmp(json_object_get_string(data_s), "@Parent") != 0))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@ static void free_all_list_open_library(struct list_head *library_list)
|
|||
{
|
||||
struct loaded_library *lib;
|
||||
while (library_list->next != library_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
lib = list_entry(library_list->next, struct loaded_library, list);
|
||||
list_del(&lib->list);
|
||||
if (lib->library) {
|
||||
|
|
@ -66,10 +62,6 @@ static void free_list_dynamic_operates(struct list_head *operate_list)
|
|||
{
|
||||
struct dynamic_operate *dyn_operate;
|
||||
while (operate_list->next != operate_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dyn_operate = list_entry(operate_list->next, struct dynamic_operate, list);
|
||||
list_del(&dyn_operate->list);
|
||||
if (dyn_operate->operate_path) {
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@ int init_supported_codecs(void)
|
|||
json_object *res = NULL;
|
||||
|
||||
dmubus_call("voice.asterisk", "codecs", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value check always
|
||||
* true. So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res)
|
||||
return -1;
|
||||
|
||||
|
|
@ -548,16 +544,8 @@ int init_call_log(void)
|
|||
if (i < call_log_list_size) {
|
||||
if (i > 0) {
|
||||
pos = pos->next;
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
entry = list_entry(pos, struct call_log_entry, list);
|
||||
} else {
|
||||
/* list_first_entry() is an external macro and which cppcheck can't
|
||||
* track so throws warning of null pointer dereferencing for second
|
||||
* argument. Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
entry = list_first_entry(&call_log_list, struct call_log_entry, list);
|
||||
pos = &entry->list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -575,10 +575,6 @@ static int get_ServicesVoiceServiceCallControlLine_CallStatus(char *refparam, st
|
|||
|
||||
snprintf(line_str, sizeof(line_str), "%d", instance ? (int)DM_STRTOL(instance) - 1 : 0);
|
||||
dmubus_call("asterisk", "call_status", UBUS_ARGS{{"line", line_str, Integer}}, 1, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value always false.
|
||||
* So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
*value = dmjson_get_value(res, 1, "call_status");
|
||||
} else {
|
||||
|
|
@ -1065,10 +1061,6 @@ static int get_ServicesVoiceServiceCallControlExtension_CallStatus(char *refpara
|
|||
|
||||
snprintf(ext_str, sizeof(ext_str), "%d", instance ? (int)DM_STRTOL(instance) - 1 : 0);
|
||||
dmubus_call("asterisk", "call_status", UBUS_ARGS{{"extension", ext_str, Integer}}, 1, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value always false.
|
||||
* So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
*value = dmjson_get_value(res, 1, "call_status");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ static int browseServicesVoiceServiceDECTBaseInst(struct dmctx *dmctx, DMNODE *p
|
|||
char *inst = NULL;
|
||||
|
||||
dmubus_call("dect", "status", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value always false.
|
||||
* So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
int id = 0, i = 0;
|
||||
|
||||
|
|
@ -54,10 +50,6 @@ static int browseServicesVoiceServiceDECTPortableInst(struct dmctx *dmctx, DMNOD
|
|||
char *inst = NULL;
|
||||
|
||||
dmubus_call("dect", "status", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value always false.
|
||||
* So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
int id = 0, i = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -191,10 +191,6 @@ static int get_ServicesVoiceServiceSIPClient_Status(char *refparam, struct dmctx
|
|||
json_object *res = NULL, *sip = NULL, *client = NULL;
|
||||
|
||||
dmubus_call("voice.asterisk", "status", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of res is being changed inside dmubus_call through pointer referencing
|
||||
* which cppcheck can't track hence throws warning for 'res' value always false.
|
||||
* So suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
sip = dmjson_get_obj(res, 1, "sip");
|
||||
if (sip) {
|
||||
|
|
|
|||
|
|
@ -98,10 +98,6 @@ static char *get_proc_state(char state)
|
|||
static int find_last_instance(void)
|
||||
{
|
||||
if (!list_empty(&process_list)) {
|
||||
/* list_first_entry() is an external macro and which cppcheck can't
|
||||
* track so throws warning of null pointer dereferencing for second
|
||||
* argument. Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
struct process_entry *entry = list_last_entry(&process_list, struct process_entry, list);
|
||||
return entry->instance + 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -292,10 +292,6 @@ static int interface_get_ipv4(const char *iface, uint32_t *addr, unsigned *bits)
|
|||
int addr_cidr = -1;
|
||||
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS {{"interface", iface, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
json_object *jobj;
|
||||
|
||||
|
|
@ -2378,10 +2374,6 @@ static int get_DHCPv4Client_IPAddress(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
char *if_name = section_name(dhcpv4_s);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
json_object *jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
|
||||
ipaddr = dmjson_get_value(jobj, 1, "address");
|
||||
|
|
@ -2406,10 +2398,6 @@ static int get_DHCPv4Client_SubnetMask(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
char *if_name = section_name(dhcpv4_s);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
json_object *jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
|
||||
mask = dmjson_get_value(jobj, 1, "mask");
|
||||
|
|
|
|||
|
|
@ -207,10 +207,6 @@ static int browseDHCPv6ServerPoolClientInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
|
||||
char *if_name = section_name(dhcp_arg->dhcp_sections->config_section);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res1);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res1 is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res1) return 0;
|
||||
device = dmjson_get_value(res1, 1, "device");
|
||||
dmubus_call("dhcp", "ipv6leases", UBUS_ARGS{0}, 0, &res);
|
||||
|
|
@ -665,10 +661,6 @@ static int get_DHCPv6Client_DUID(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
char *if_name = section_name(dhcpv6_s);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(res) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
*value = res ? dmjson_get_value(res, 2, "data", "passthru") : "";
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -171,10 +171,6 @@ static char *get_dsl_value_without_argument(char *command1, char *id, char *comm
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value(res, 1, key);
|
||||
return value;
|
||||
|
|
@ -187,10 +183,6 @@ static char *get_dsl_value_without_argument_and_with_two_key(char *command1, cha
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value(res, 2, key1, key2);
|
||||
return value;
|
||||
|
|
@ -203,10 +195,6 @@ char *get_value_with_argument(char *command1, char *id, char *command2, char *ar
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{{"interval", argument, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value(res, 1, key);
|
||||
return value;
|
||||
|
|
@ -219,10 +207,6 @@ static char *get_dsl_value_array_without_argument(char *command1, char *id, char
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res is always false. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value_array_all(res, ",", 1, key);
|
||||
return value;
|
||||
|
|
|
|||
|
|
@ -342,10 +342,6 @@ static int browseEthernetRMONStatsInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
|
||||
|
||||
dmubus_call("ethernet", "rmonstats", UBUS_ARGS{{"ifname", ifname, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) continue;
|
||||
|
||||
init_eth_rmon(&curr_eth_rmon_args, p, res);
|
||||
|
|
@ -1638,10 +1634,6 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
break;
|
||||
}
|
||||
|
||||
/* dev_name, inner_vud are assigned by dmuci_get_value_by_section_string() by
|
||||
* pointer referencing and cppcheck can't track it so throws warning of
|
||||
* uninitialized variable. so suppressed the warning */
|
||||
// cppcheck-suppress uninitvar
|
||||
snprintf(new_name, sizeof(new_name), "%s.%s.%s", dev_name, inner_vid, vid);
|
||||
if (ethernet___name_exists_in_devices(new_name))
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -100,10 +100,6 @@ static char *get_fast_value_without_argument(char *command1, char *id, char *com
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value(res, 1, key);
|
||||
return value;
|
||||
|
|
@ -116,10 +112,6 @@ static char *get_fast_value_without_argument_and_with_two_key(char *command1, ch
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value(res, 2, key1, key2);
|
||||
return value;
|
||||
|
|
@ -132,10 +124,6 @@ static char *get_fast_value_array_without_argument(char *command1, char *id, cha
|
|||
|
||||
snprintf(command, sizeof(command), "%s.%s", command1, id);
|
||||
dmubus_call(command, command2, UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return "";
|
||||
value = dmjson_get_value_array_all(res, ",", 1, key);
|
||||
return value;
|
||||
|
|
|
|||
|
|
@ -173,10 +173,6 @@ static char *get_gre_tunnel_interface_statistics(char *interface, char *key)
|
|||
char *device, *value = "0";
|
||||
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", interface, String}}, 1, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res) return value;
|
||||
device = dmjson_get_value(res, 1, "device");
|
||||
if(device[0] != '\0') {
|
||||
|
|
|
|||
|
|
@ -660,6 +660,7 @@ static int set_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *dat
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
// cppcheck-suppress unknownMacro
|
||||
uci_path_foreach_option_eq(bbfdm, "dmmap_interface_stack", "interface_stack", "interface_stack_instance", instance, s)
|
||||
dmuci_set_value_by_section(s, "interface_stack_alias", value);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -214,10 +214,6 @@ static int get_ptm_fast_line(struct dmctx *ctx, void *data, char *instance, char
|
|||
json_object *res = NULL, *line_obj = NULL;
|
||||
|
||||
dmubus_call("fast", "status", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!res)
|
||||
return 0;
|
||||
line_obj = dmjson_select_obj_in_array_idx(res, 0, 1, "line");
|
||||
|
|
|
|||
|
|
@ -112,10 +112,6 @@ static bool is_proc_route6_in_config(char *cdev, char *cip, char *cgw)
|
|||
dmuci_get_value_by_section_string(s, "gateway", &gw_r);
|
||||
dmuci_get_value_by_section_string(s, "interface", &intf_r);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", intf_r, String}}, 1, &jobj);
|
||||
/* value of 'jobj' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(jobj) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
char *dev_r = (jobj) ? dmjson_get_value(jobj, 1, "device") : "";
|
||||
if (DM_STRCMP(cdev, dev_r) == 0 && DM_STRCMP(cgw, gw_r) == 0 && DM_STRCMP(cip, ip_r) == 0)
|
||||
return true;
|
||||
|
|
@ -129,10 +125,6 @@ static bool is_proc_route6_in_config(char *cdev, char *cip, char *cgw)
|
|||
dmuci_get_value_by_section_string(s, "gateway", &gw_r6);
|
||||
dmuci_get_value_by_section_string(s, "interface", &intf_r6);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", intf_r6, String}}, 1, &jobj);
|
||||
/* value of 'jobj' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(jobj) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
char *dev_r6 = (jobj) ? dmjson_get_value(jobj, 1, "device") : "";
|
||||
if (DM_STRCMP(cdev, dev_r6) == 0 && DM_STRCMP(cgw, gw_r6) == 0 && DM_STRCMP(cip, ip_r6) == 0)
|
||||
return true;
|
||||
|
|
@ -326,10 +318,6 @@ static int dmmap_synchronizeRoutingRouterIPv6Forwarding(struct dmctx *dmctx, DMN
|
|||
|
||||
char *if_name = section_name(s);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &jobj);
|
||||
/* value of 'jobj' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(jobj) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!jobj) {
|
||||
fclose(fp);
|
||||
return 0;
|
||||
|
|
@ -969,10 +957,6 @@ static int get_RoutingRouteInformationInterfaceSetting_Interface(char *refparam,
|
|||
|
||||
char *if_name = section_name(s);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &jobj);
|
||||
/* value of 'jobj' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(jobj) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (!jobj) return 0;
|
||||
char *str = dmjson_get_value(jobj, 1, "device");
|
||||
if (DM_STRCMP(str, dev) == 0) {
|
||||
|
|
|
|||
|
|
@ -106,10 +106,6 @@ static int browseUPnPDiscoveryRootDeviceInst(struct dmctx *dmctx, DMNODE *parent
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as !res is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "devices", &devices);
|
||||
|
|
@ -159,10 +155,6 @@ static int browseUPnPDiscoveryDeviceInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res==NULL is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "devices", &devices);
|
||||
|
|
@ -208,10 +200,6 @@ static int browseUPnPDiscoveryServiceInst(struct dmctx *dmctx, DMNODE *parent_no
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "discovery", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res==NULL is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "services", &services);
|
||||
|
|
@ -255,10 +243,6 @@ static int browseUPnPDescriptionDeviceDescriptionInst(struct dmctx *dmctx, DMNOD
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res==NULL is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "descriptions", &descriptions);
|
||||
|
|
@ -292,10 +276,6 @@ static int browseUPnPDescriptionDeviceInstanceInst(struct dmctx *dmctx, DMNODE *
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res==NULL is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "devicesinstances", &devices_instances);
|
||||
|
|
@ -340,10 +320,6 @@ static int browseUPnPDescriptionServiceInstanceInst(struct dmctx *dmctx, DMNODE
|
|||
int i;
|
||||
|
||||
dmubus_call("upnpc", "description", UBUS_ARGS{{}}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as res==NULL is always true. so
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res == NULL)
|
||||
return 0;
|
||||
json_object_object_get_ex(res, "servicesinstances", &services_instances);
|
||||
|
|
|
|||
|
|
@ -139,10 +139,6 @@ static char *get_radio_option_nocache(const char *device_name, char *option)
|
|||
snprintf(object, sizeof(object), "wifi.radio.%s", device_name);
|
||||
dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res);
|
||||
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(res) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
return (res) ? dmjson_get_value(res, 1, option) : "";
|
||||
}
|
||||
|
||||
|
|
@ -3032,6 +3028,7 @@ static int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, st
|
|||
return 0;
|
||||
case VALUESET:
|
||||
if (DM_LSTRCMP(value, "Requested") == 0) {
|
||||
// cppcheck-suppress unknownMacro
|
||||
uci_foreach_sections("wireless", "wifi-device", ss)
|
||||
wifi_start_scan(section_name(ss));
|
||||
|
||||
|
|
@ -5754,10 +5751,6 @@ static int operate_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx *
|
|||
json_object *res = NULL;
|
||||
|
||||
dmubus_call("wifi", "status", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(res) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
json_object *radios = NULL, *arrobj = NULL;
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -539,10 +539,6 @@ static int browse_igmp_cgrp_inst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
char *inst = NULL;
|
||||
|
||||
dmubus_call("mcast", "stats", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(res) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
int i = 0, id = 0;
|
||||
|
||||
|
|
@ -654,10 +650,6 @@ static int get_igmp_cgrps_no_of_entries(char *refparam, struct dmctx *ctx, void
|
|||
json_object *res = NULL, *jobj = NULL, *arrobj = NULL, *group_obj = NULL;
|
||||
|
||||
dmubus_call("mcast", "stats", UBUS_ARGS{0}, 0, &res);
|
||||
/* value of 'res' is being changed inside dmubus_call by pointer reference,
|
||||
* which cppcheck can't track and throws warning as if(res) is always false.
|
||||
* so suppressed the warning */
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (res) {
|
||||
int i = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -914,10 +914,6 @@ void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, c
|
|||
struct list_head *ilist = NULL;
|
||||
|
||||
list_for_each(ilist, &ctx->list_parameter) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dm_parameter = list_entry(ilist, struct dm_parameter, list);
|
||||
int cmp = DM_STRCMP(dm_parameter->name, param_name);
|
||||
if (cmp == 0) {
|
||||
|
|
@ -945,10 +941,6 @@ void free_all_list_parameter(struct dmctx *ctx)
|
|||
{
|
||||
struct dm_parameter *dm_parameter = NULL;
|
||||
while (ctx->list_parameter.next != &ctx->list_parameter) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dm_parameter = list_entry(ctx->list_parameter.next, struct dm_parameter, list);
|
||||
api_del_list_parameter(dm_parameter);
|
||||
}
|
||||
|
|
@ -975,10 +967,6 @@ void free_all_set_list_tmp(struct dmctx *ctx)
|
|||
{
|
||||
struct set_tmp *set_tmp = NULL;
|
||||
while (ctx->set_list_tmp.next != &ctx->set_list_tmp) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
set_tmp = list_entry(ctx->set_list_tmp.next, struct set_tmp, list);
|
||||
del_set_list_tmp(set_tmp);
|
||||
}
|
||||
|
|
@ -1006,10 +994,6 @@ void free_all_list_fault_param(struct dmctx *ctx)
|
|||
{
|
||||
struct param_fault *param_fault = NULL;
|
||||
while (ctx->list_fault_param.next != &ctx->list_fault_param) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
param_fault = list_entry(ctx->list_fault_param.next, struct param_fault, list);
|
||||
bbf_api_del_list_fault_param(param_fault);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,10 +250,6 @@ void free_dmmap_config_dup_list(struct list_head *dup_list)
|
|||
{
|
||||
struct dmmap_dup *dmmap_config = NULL;
|
||||
while (dup_list->next != dup_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dmmap_config = list_entry(dup_list->next, struct dmmap_dup, list);
|
||||
dmmap_config_dup_delete(dmmap_config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@ struct list_head *mem_list, void *n, size_t size
|
|||
{
|
||||
struct dmmem *m = NULL;
|
||||
if (n != NULL) {
|
||||
/* container_of() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
m = container_of(n, struct dmmem, mem);
|
||||
list_del(&m->list);
|
||||
}
|
||||
|
|
@ -88,10 +84,6 @@ inline void dmfree(void *m)
|
|||
{
|
||||
if (m == NULL) return;
|
||||
struct dmmem *rm;
|
||||
/* container_of() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
rm = container_of(m, struct dmmem, mem);
|
||||
list_del(&rm->list);
|
||||
free(rm);
|
||||
|
|
@ -101,10 +93,6 @@ inline void __dmcleanmem(struct list_head *mem_list)
|
|||
{
|
||||
struct dmmem *dmm;
|
||||
while (mem_list->next != mem_list) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
dmm = list_entry(mem_list->next, struct dmmem, list);
|
||||
#ifdef WITH_MEMTRACK
|
||||
fprintf(stderr, "Allocated memory in {%s, %s(), line %d} is not freed\n", dmm->file, dmm->func, dmm->line);
|
||||
|
|
|
|||
|
|
@ -246,10 +246,6 @@ static void dmubus_receive_event(struct ubus_context *ctx, struct ubus_event_han
|
|||
if (!msg || !ev)
|
||||
return;
|
||||
|
||||
/* container_of() is an external macro and which cppcheck can't track
|
||||
* so throws warning of null pointer dereferencing for second argument
|
||||
* suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
data = container_of(ev, struct dmubus_event_data, ev);
|
||||
if (validate_blob_message(data->ev_msg, msg) == true) {
|
||||
uloop_end();
|
||||
|
|
@ -695,6 +691,7 @@ void dmubus_free()
|
|||
{
|
||||
struct dm_ubus_cache_entry *entry, *tmp;
|
||||
|
||||
// cppcheck-suppress unknownMacro
|
||||
list_for_each_entry_safe(entry, tmp, &dmubus_cache, list)
|
||||
dm_ubus_cache_entry_free(entry);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,10 +117,6 @@ void free_all_list_package_change(struct list_head *clist)
|
|||
{
|
||||
struct package_change *pc;
|
||||
while (clist->next != clist) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
pc = list_entry(clist->next, struct package_change, list);
|
||||
list_del(&pc->list);
|
||||
free(pc->package);//TODO !!!!! Do not use dmfree here
|
||||
|
|
|
|||
|
|
@ -718,10 +718,6 @@ static int libbbf_ubus_set_handler(struct ubus_context *ctx, struct ubus_object
|
|||
}
|
||||
|
||||
while (bbf_ctx.list_fault_param.next != &bbf_ctx.list_fault_param) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
struct param_fault *p = list_entry(bbf_ctx.list_fault_param.next, struct param_fault, list);
|
||||
table = blobmsg_open_table(&bb, NULL);
|
||||
bb_add_string(&bb, "path", p->name);
|
||||
|
|
@ -742,10 +738,6 @@ static int libbbf_ubus_set_handler(struct ubus_context *ctx, struct ubus_object
|
|||
array = blobmsg_open_array(&bb, "parameters");
|
||||
|
||||
while (bbf_ctx.list_fault_param.next != &bbf_ctx.list_fault_param) {
|
||||
/* list_entry() is an external macro and which cppcheck can't track so
|
||||
* throws warning of null pointer dereferencing for second argument.
|
||||
* Suppressed the warning */
|
||||
// cppcheck-suppress nullPointer
|
||||
struct param_fault *p = list_entry(bbf_ctx.list_fault_param.next, struct param_fault, list);
|
||||
table = blobmsg_open_table(&bb, NULL);
|
||||
bb_add_string(&bb, "path", p->name);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue