From ce3320f5c67e8926f9f4b18d4739b68c7820562b Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 16 Jun 2019 12:21:05 -0700 Subject: [PATCH] Don't use empty initializer lists --- bridge/mdb.c | 2 +- bridge/vlan.c | 4 +- devlink/devlink.c | 94 +++++++++++++++++++++++------------------------ devlink/mnlg.c | 6 +-- ip/ip6tunnel.c | 2 +- ip/ipaddress.c | 8 ++-- ip/ipaddrlabel.c | 2 +- ip/ipl2tp.c | 2 +- ip/iplink.c | 2 +- ip/iplink_can.c | 2 +- ip/ipmacsec.c | 2 +- ip/ipmaddr.c | 2 +- ip/ipntable.c | 4 +- ip/iptunnel.c | 10 ++--- ip/iptuntap.c | 2 +- ip/ipxfrm.c | 14 +++---- ip/xfrm_policy.c | 12 +++--- ip/xfrm_state.c | 12 +++--- lib/bpf.c | 42 ++++++++++----------- lib/libnetlink.c | 4 +- lib/ll_map.c | 2 +- misc/arpd.c | 4 +- misc/ss.c | 38 +++++++++---------- rdma/dev.c | 2 +- rdma/link.c | 2 +- rdma/rdma.c | 2 +- rdma/res-cmid.c | 6 +-- rdma/res-cq.c | 6 +-- rdma/res-mr.c | 6 +-- rdma/res-pd.c | 6 +-- rdma/res-qp.c | 6 +-- rdma/res.c | 4 +- rdma/utils.c | 2 +- tc/e_bpf.c | 4 +- tc/em_cmp.c | 2 +- tc/em_ipset.c | 2 +- tc/em_meta.c | 2 +- tc/em_nbyte.c | 2 +- tc/em_u32.c | 2 +- tc/f_bpf.c | 2 +- tc/f_fw.c | 2 +- tc/f_rsvp.c | 2 +- tc/f_u32.c | 6 +-- tc/m_bpf.c | 4 +- tc/m_connmark.c | 2 +- tc/m_csum.c | 2 +- tc/m_mirred.c | 4 +- tc/m_nat.c | 2 +- tc/m_pedit.c | 4 +- tc/m_simple.c | 2 +- tc/m_tunnel_key.c | 2 +- tc/m_vlan.c | 2 +- tc/m_xt.c | 2 +- tc/q_atm.c | 2 +- tc/q_cbq.c | 12 +++--- tc/q_cbs.c | 2 +- tc/q_choke.c | 2 +- tc/q_codel.c | 2 +- tc/q_fifo.c | 2 +- tc/q_fq_codel.c | 2 +- tc/q_gred.c | 6 +-- tc/q_hfsc.c | 4 +- tc/q_htb.c | 2 +- tc/q_multiq.c | 2 +- tc/q_netem.c | 12 +++--- tc/q_red.c | 2 +- tc/q_sfq.c | 2 +- tc/q_skbprio.c | 2 +- tc/q_tbf.c | 2 +- tc/tc_class.c | 18 ++++----- tc/tc_exec.c | 2 +- tc/tc_filter.c | 12 +++--- tc/tc_qdisc.c | 10 ++--- tc/tc_stab.c | 2 +- tc/tc_util.c | 6 +-- tipc/bearer.c | 22 +++++------ tipc/link.c | 34 ++++++++--------- tipc/media.c | 10 ++--- tipc/misc.c | 2 +- tipc/msg.c | 2 +- tipc/nametable.c | 6 +-- tipc/node.c | 14 +++---- tipc/socket.c | 10 ++--- 83 files changed, 287 insertions(+), 287 deletions(-) diff --git a/bridge/mdb.c b/bridge/mdb.c index 1f2cebd8..124fef49 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -377,7 +377,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) .n.nlmsg_type = cmd, .bpm.family = PF_BRIDGE, }; - struct br_mdb_entry entry = {}; + struct br_mdb_entry entry = {0}; char *d = NULL, *p = NULL, *grp = NULL; short vid = 0; diff --git a/bridge/vlan.c b/bridge/vlan.c index f65e47f6..21233a84 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -102,7 +102,7 @@ static int add_tunnel_info_range(struct nlmsghdr *n, int reqsize, static int add_vlan_info_range(struct nlmsghdr *n, int reqsize, __u16 vid_start, int16_t vid_end, __u16 flags) { - struct bridge_vlan_info vinfo = {}; + struct bridge_vlan_info vinfo = {0}; vinfo.flags = flags; vinfo.vid = vid_start; @@ -141,7 +141,7 @@ static int vlan_modify(int cmd, int argc, char **argv) short vid = -1; short vid_end = -1; struct rtattr *afspec; - struct bridge_vlan_info vinfo = {}; + struct bridge_vlan_info vinfo = {0}; bool tunnel_info_set = false; unsigned short flags = 0; __u32 tun_id_start = 0; diff --git a/devlink/devlink.c b/devlink/devlink.c index 73ce9865..fec6f104 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -551,7 +551,7 @@ static int attr_stats_cb(const struct nlattr *attr, void *data) static int ifname_map_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); struct dl *dl = data; struct ifname_map *ifname_map; @@ -2130,7 +2130,7 @@ static void pr_out_eswitch(struct dl *dl, struct nlattr **tb) static int cmd_dev_eswitch_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -2293,7 +2293,7 @@ static const struct param_val_conv param_val_conv[] = { static void pr_out_param_value(struct dl *dl, const char *nla_name, int nla_type, struct nlattr *nl) { - struct nlattr *nla_value[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_value[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *val_attr; const char *vstr; bool conv_exists; @@ -2375,7 +2375,7 @@ static void pr_out_param_value(struct dl *dl, const char *nla_name, static void pr_out_param(struct dl *dl, struct nlattr **tb, bool array) { - struct nlattr *nla_param[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_param[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *param_value_attr; const char *nla_name; int nla_type; @@ -2418,7 +2418,7 @@ static void pr_out_param(struct dl *dl, struct nlattr **tb, bool array) static int cmd_dev_param_show_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct dl *dl = data; mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -2444,8 +2444,8 @@ struct param_ctx { static int cmd_dev_param_set_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *nla_param[DEVLINK_ATTR_MAX + 1] = {}; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_param[DEVLINK_ATTR_MAX + 1] = {0}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *param_value_attr; enum devlink_param_cmode cmode; struct param_ctx *ctx = data; @@ -2469,7 +2469,7 @@ static int cmd_dev_param_set_cb(const struct nlmsghdr *nlh, void *data) nla_type = mnl_attr_get_u8(nla_param[DEVLINK_ATTR_PARAM_TYPE]); mnl_attr_for_each_nested(param_value_attr, nla_param[DEVLINK_ATTR_PARAM_VALUES_LIST]) { - struct nlattr *nla_value[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_value[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *val_attr; err = mnl_attr_parse_nested(param_value_attr, @@ -2511,7 +2511,7 @@ static int cmd_dev_param_set_cb(const struct nlmsghdr *nlh, void *data) static int cmd_dev_param_set(struct dl *dl) { - struct param_ctx ctx = {}; + struct param_ctx ctx = {0}; struct nlmsghdr *nlh; bool conv_exists; uint32_t val_u32; @@ -2666,7 +2666,7 @@ static int cmd_dev_param(struct dl *dl) static int cmd_dev_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); uint8_t reload_failed = 0; @@ -2743,7 +2743,7 @@ static void pr_out_versions_single(struct dl *dl, const struct nlmsghdr *nlh, struct nlattr *version; mnl_attr_for_each(version, nlh, sizeof(struct genlmsghdr)) { - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; const char *ver_value; const char *ver_name; int err; @@ -2823,7 +2823,7 @@ static void pr_out_info(struct dl *dl, const struct nlmsghdr *nlh, static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; bool has_versions, has_info; struct dl *dl = data; @@ -3226,7 +3226,7 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb) static int cmd_port_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3370,7 +3370,7 @@ static void pr_out_sb(struct dl *dl, struct nlattr **tb) static int cmd_sb_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3449,7 +3449,7 @@ static void pr_out_sb_pool(struct dl *dl, struct nlattr **tb) static int cmd_sb_pool_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3535,7 +3535,7 @@ static void pr_out_sb_port_pool(struct dl *dl, struct nlattr **tb) static int cmd_sb_port_pool_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3638,7 +3638,7 @@ static void pr_out_sb_tc_bind(struct dl *dl, struct nlattr **tb) static int cmd_sb_tc_bind_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3926,7 +3926,7 @@ static void cmd_sb_occ_port_pool_process(struct occ_show *occ_show, static int cmd_sb_occ_port_pool_process_cb(const struct nlmsghdr *nlh, void *data) { struct occ_show *occ_show = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -3977,7 +3977,7 @@ static void cmd_sb_occ_tc_pool_process(struct occ_show *occ_show, static int cmd_sb_occ_tc_pool_process_cb(const struct nlmsghdr *nlh, void *data) { struct occ_show *occ_show = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -4235,7 +4235,7 @@ static void pr_out_trap_group(struct dl *dl, struct nlattr **tb, bool array); static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data) { struct dl *dl = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); uint8_t cmd = genl->cmd; @@ -4727,7 +4727,7 @@ static void pr_out_dpipe_headers(struct dpipe_ctx *ctx, static int dpipe_header_field_get(struct nlattr *nl, struct dpipe_field *field) { - struct nlattr *nla_field[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_field[DEVLINK_ATTR_MAX + 1] = {0}; const char *name; int err; @@ -4778,7 +4778,7 @@ static unsigned int dpipe_header_field_count_get(struct nlattr *nla_fields) static int dpipe_header_get(struct dpipe_ctx *ctx, struct nlattr *nl) { - struct nlattr *nla_header[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_header[DEVLINK_ATTR_MAX + 1] = {0}; struct dpipe_header *header; unsigned int fields_count; const char *header_name; @@ -4834,7 +4834,7 @@ static int dpipe_headers_get(struct dpipe_ctx *ctx, struct nlattr **tb) static int cmd_dpipe_header_cb(const struct nlmsghdr *nlh, void *data) { struct dpipe_ctx *ctx = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); int err; @@ -4856,7 +4856,7 @@ static int cmd_dpipe_header_cb(const struct nlmsghdr *nlh, void *data) static int cmd_dpipe_headers_show(struct dl *dl) { struct nlmsghdr *nlh; - struct dpipe_ctx ctx = {}; + struct dpipe_ctx ctx = {0}; uint16_t flags = NLM_F_REQUEST | NLM_F_ACK; int err; @@ -4947,7 +4947,7 @@ static void pr_out_dpipe_action(struct dpipe_action *action, static int dpipe_action_parse(struct dpipe_action *action, struct nlattr *nl) { - struct nlattr *nla_action[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_action[DEVLINK_ATTR_MAX + 1] = {0}; int err; err = mnl_attr_parse_nested(nl, attr_cb, nla_action); @@ -5032,7 +5032,7 @@ static int dpipe_match_parse(struct dpipe_match *match, struct nlattr *nl) { - struct nlattr *nla_match[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_match[DEVLINK_ATTR_MAX + 1] = {0}; int err; err = mnl_attr_parse_nested(nl, attr_cb, nla_match); @@ -5137,7 +5137,7 @@ resource_path_print(struct dl *dl, struct resources *resources, static int dpipe_table_show(struct dpipe_ctx *ctx, struct nlattr *nl) { - struct nlattr *nla_table[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_table[DEVLINK_ATTR_MAX + 1] = {0}; struct dpipe_table *table; uint32_t resource_units; bool counters_enabled; @@ -5231,7 +5231,7 @@ err_table_show: static int cmd_dpipe_table_show_cb(const struct nlmsghdr *nlh, void *data) { struct dpipe_ctx *ctx = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -5249,8 +5249,8 @@ static int cmd_resource_dump_cb(const struct nlmsghdr *nlh, void *data); static int cmd_dpipe_table_show(struct dl *dl) { struct nlmsghdr *nlh; - struct dpipe_ctx dpipe_ctx = {}; - struct resource_ctx resource_ctx = {}; + struct dpipe_ctx dpipe_ctx = {0}; + struct resource_ctx resource_ctx = {0}; uint16_t flags = NLM_F_REQUEST; int err; @@ -5507,7 +5507,7 @@ static void pr_out_dpipe_entry_value(struct dpipe_ctx *ctx, static int dpipe_entry_match_value_show(struct dpipe_ctx *ctx, struct nlattr *nl) { - struct nlattr *nla_match_value[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_match_value[DEVLINK_ATTR_MAX + 1] = {0}; struct dpipe_match match; int err; @@ -5538,7 +5538,7 @@ err_match_parse: static int dpipe_entry_action_value_show(struct dpipe_ctx *ctx, struct nlattr *nl) { - struct nlattr *nla_action_value[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_action_value[DEVLINK_ATTR_MAX + 1] = {0}; struct dpipe_action action; int err; @@ -5594,7 +5594,7 @@ dpipe_tables_match_values_show(struct dpipe_ctx *ctx, static int dpipe_entry_show(struct dpipe_ctx *ctx, struct nlattr *nl) { - struct nlattr *nla_entry[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_entry[DEVLINK_ATTR_MAX + 1] = {0}; uint32_t entry_index; uint64_t counter; int err; @@ -5658,7 +5658,7 @@ err_entry_show: static int cmd_dpipe_table_entry_dump_cb(const struct nlmsghdr *nlh, void *data) { struct dpipe_ctx *ctx = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -5674,7 +5674,7 @@ static int cmd_dpipe_table_entry_dump_cb(const struct nlmsghdr *nlh, void *data) static int cmd_dpipe_table_dump(struct dl *dl) { struct nlmsghdr *nlh; - struct dpipe_ctx ctx = {}; + struct dpipe_ctx ctx = {0}; uint16_t flags = NLM_F_REQUEST; int err; @@ -5795,7 +5795,7 @@ static int resource_get(struct resource_ctx *ctx, struct resource *resource, struct resource *parent_resource, struct nlattr *nl) { - struct nlattr *nla_resource[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *nla_resource[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *nla_child_resource; struct nlattr *nla_resources; bool top = false; @@ -5943,7 +5943,7 @@ static int resources_get(struct resource_ctx *ctx, struct nlattr **tb) static int cmd_resource_dump_cb(const struct nlmsghdr *nlh, void *data) { struct resource_ctx *ctx = data; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); int err; @@ -5967,8 +5967,8 @@ static int cmd_resource_dump_cb(const struct nlmsghdr *nlh, void *data) static int cmd_resource_show(struct dl *dl) { struct nlmsghdr *nlh; - struct dpipe_ctx dpipe_ctx = {}; - struct resource_ctx resource_ctx = {}; + struct dpipe_ctx dpipe_ctx = {0}; + struct resource_ctx resource_ctx = {0}; int err; err = dl_argv_parse(dl, DL_OPT_HANDLE, 0); @@ -6063,7 +6063,7 @@ err_resource_lookup: static int cmd_resource_set(struct dl *dl) { struct nlmsghdr *nlh; - struct resource_ctx ctx = {}; + struct resource_ctx ctx = {0}; int err; err = resource_ctx_init(&ctx, dl); @@ -6175,7 +6175,7 @@ static void pr_out_region_snapshots_id(struct dl *dl, struct nlattr **tb, int in static void pr_out_snapshots(struct dl *dl, struct nlattr **tb) { - struct nlattr *tb_snapshot[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb_snapshot[DEVLINK_ATTR_MAX + 1] = {0}; struct nlattr *nla_sanpshot; int err, index = 0; @@ -6216,7 +6216,7 @@ static void pr_out_region(struct dl *dl, struct nlattr **tb) static int cmd_region_show_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct dl *dl = data; mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); @@ -6272,8 +6272,8 @@ static int cmd_region_read_cb(const struct nlmsghdr *nlh, void *data) { struct nlattr *nla_entry, *nla_chunk_data, *nla_chunk_addr; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb_field[DEVLINK_ATTR_MAX + 1] = {}; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb_field[DEVLINK_ATTR_MAX + 1] = {0}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct dl *dl = data; int err; @@ -6578,7 +6578,7 @@ static int cmd_fmsg_nest(struct fmsg_cb_data *fmsg_data, uint8_t nest_value, static int cmd_fmsg_object_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct fmsg_cb_data *fmsg_data = data; struct dl *dl = fmsg_data->dl; struct nlattr *nla_object; @@ -6759,7 +6759,7 @@ static void pr_out_dump_report_timestamp(struct dl *dl, const struct nlattr *att static void pr_out_health(struct dl *dl, struct nlattr **tb_health) { - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; enum devlink_health_reporter_state state; int err; @@ -6808,7 +6808,7 @@ static void pr_out_health(struct dl *dl, struct nlattr **tb_health) static int cmd_health_show_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {}; + struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {0}; struct dl *dl = data; mnl_attr_parse(nlh, sizeof(*genl), attr_cb, tb); diff --git a/devlink/mnlg.c b/devlink/mnlg.c index c7d25e87..baeda3d8 100644 --- a/devlink/mnlg.c +++ b/devlink/mnlg.c @@ -154,7 +154,7 @@ static void parse_genl_mc_grps(struct nlattr *nested, const char *name; mnl_attr_for_each_nested(pos, nested) { - struct nlattr *tb[CTRL_ATTR_MCAST_GRP_MAX + 1] = {}; + struct nlattr *tb[CTRL_ATTR_MCAST_GRP_MAX + 1] = {0}; mnl_attr_parse_nested(pos, parse_mc_grps_cb, tb); if (!tb[CTRL_ATTR_MCAST_GRP_NAME] || @@ -188,7 +188,7 @@ static int get_group_id_attr_cb(const struct nlattr *attr, void *data) static int get_group_id_cb(const struct nlmsghdr *nlh, void *data) { struct group_info *group_info = data; - struct nlattr *tb[CTRL_ATTR_MAX + 1] = {}; + struct nlattr *tb[CTRL_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), get_group_id_attr_cb, tb); @@ -249,7 +249,7 @@ static int get_family_id_attr_cb(const struct nlattr *attr, void *data) static int get_family_id_cb(const struct nlmsghdr *nlh, void *data) { uint32_t *p_id = data; - struct nlattr *tb[CTRL_ATTR_MAX + 1] = {}; + struct nlattr *tb[CTRL_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); mnl_attr_parse(nlh, sizeof(*genl), get_family_id_attr_cb, tb); diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index c712d664..318e54b1 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -286,7 +286,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) if (get_ifname(p->name, *argv)) invarg("\"name\" not a valid ifname", *argv); if (cmd == SIOCCHGTUNNEL && count == 0) { - struct ip6_tnl_parm2 old_p = {}; + struct ip6_tnl_parm2 old_p = {0}; if (tnl_get_ioctl(*argv, &old_p)) return -1; diff --git a/ip/ipaddress.c b/ip/ipaddress.c index b7e91324..c9b5f059 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -168,7 +168,7 @@ static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1]) if (tb[IFLA_TXQLEN]) qlen = rta_getattr_u32(tb[IFLA_TXQLEN]); else { - struct ifreq ifr = {}; + struct ifreq ifr = {0}; int s = socket(AF_INET, SOCK_STREAM, 0); if (s < 0) @@ -356,7 +356,7 @@ static void print_vfinfo(FILE *fp, struct ifinfomsg *ifi, struct rtattr *vfinfo) struct ifla_vf_mac *vf_mac; struct ifla_vf_broadcast *vf_broadcast; struct ifla_vf_tx_rate *vf_tx_rate; - struct rtattr *vf[IFLA_VF_MAX + 1] = {}; + struct rtattr *vf[IFLA_VF_MAX + 1] = {0}; SPRINT_BUF(b1); @@ -2221,7 +2221,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) char *lcl_arg = NULL; char *valid_lftp = NULL; char *preferred_lftp = NULL; - inet_prefix lcl = {}; + inet_prefix lcl = {0}; inet_prefix peer; int local_len = 0; int peer_len = 0; @@ -2406,7 +2406,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) return nodev(d); if (valid_lftp || preferred_lftp) { - struct ifa_cacheinfo cinfo = {}; + struct ifa_cacheinfo cinfo = {0}; if (!valid_lft) { fprintf(stderr, "valid_lft is zero\n"); diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c index beb08da3..c8a14940 100644 --- a/ip/ipaddrlabel.c +++ b/ip/ipaddrlabel.c @@ -148,7 +148,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) .ifal.ifal_family = preferred_family, }; - inet_prefix prefix = {}; + inet_prefix prefix = {0}; uint32_t label = 0xffffffffUL; char *p = NULL; char *l = NULL; diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c index f090390f..edbe0f2f 100644 --- a/ip/ipl2tp.c +++ b/ip/ipl2tp.c @@ -345,7 +345,7 @@ static int get_response(struct nlmsghdr *n, void *arg) if (len < 0) return -1; - parse_rtattr(attrs, L2TP_ATTR_MAX, (void *)ghdr + GENL_HDRLEN, len); + parse_rtattr(attrs, L2TP_ATTR_MAX, (struct rtattr *)((char *)ghdr + GENL_HDRLEN), len); if (attrs[L2TP_ATTR_PW_TYPE]) p->pw_type = rta_getattr_u16(attrs[L2TP_ATTR_PW_TYPE]); diff --git a/ip/iplink.c b/ip/iplink.c index 47f73988..edb88b02 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -1233,7 +1233,7 @@ static int set_mtu(const char *dev, int mtu) static int get_address(const char *dev, int *htype) { - struct ifreq ifr = {}; + struct ifreq ifr = {0}; struct sockaddr_ll me = { .sll_family = AF_PACKET, .sll_protocol = htons(ETH_P_LOOP), diff --git a/ip/iplink_can.c b/ip/iplink_can.c index 735ab941..82060bf4 100644 --- a/ip/iplink_can.c +++ b/ip/iplink_can.c @@ -112,7 +112,7 @@ static void print_ctrlmode(FILE *f, __u32 cm) static int can_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { - struct can_bittiming bt = {}, dbt = {}; + struct can_bittiming bt = {0}, dbt = {0}; struct can_ctrlmode cm = {0, 0}; while (argc > 0) { diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c index ad6ad7d6..1512823a 100644 --- a/ip/ipmacsec.c +++ b/ip/ipmacsec.c @@ -958,7 +958,7 @@ static int process(struct nlmsghdr *n, void *arg) if (ghdr->cmd != MACSEC_CMD_GET_TXSC) return 0; - parse_rtattr(attrs, MACSEC_ATTR_MAX, (void *) ghdr + GENL_HDRLEN, len); + parse_rtattr(attrs, MACSEC_ATTR_MAX, (struct rtattr *)((char *)ghdr + GENL_HDRLEN), len); if (!validate_dump(attrs)) { fprintf(stderr, "incomplete dump message\n"); return -1; diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c index 02e923bf..44699b9e 100644 --- a/ip/ipmaddr.c +++ b/ip/ipmaddr.c @@ -289,7 +289,7 @@ static int multiaddr_list(int argc, char **argv) static int multiaddr_modify(int cmd, int argc, char **argv) { - struct ifreq ifr = {}; + struct ifreq ifr = {0}; int family; int fd; diff --git a/ip/ipntable.c b/ip/ipntable.c index ddee4905..a56c71e5 100644 --- a/ip/ipntable.c +++ b/ip/ipntable.c @@ -76,7 +76,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv) char *namep = NULL; char *threshsp = NULL; char *gc_intp = NULL; - char parms_buf[1024] = {}; + char parms_buf[1024] = {0}; struct rtattr *parms_rta = (struct rtattr *)parms_buf; int parms_change = 0; @@ -312,7 +312,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv) static const char *ntable_strtime_delta(__u32 msec) { static char str[32]; - struct timeval now = {}; + struct timeval now = {0}; time_t t; struct tm *tp; diff --git a/ip/iptunnel.c b/ip/iptunnel.c index 696f3b92..92b86c17 100644 --- a/ip/iptunnel.c +++ b/ip/iptunnel.c @@ -176,7 +176,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) if (get_ifname(p->name, *argv)) invarg("\"name\" not a valid ifname", *argv); if (cmd == SIOCCHGTUNNEL && count == 0) { - struct ip_tunnel_parm old_p = {}; + struct ip_tunnel_parm old_p = {0}; if (tnl_get_ioctl(*argv, &old_p)) return -1; @@ -288,7 +288,7 @@ static int do_del(int argc, char **argv) static void print_tunnel(const void *t) { const struct ip_tunnel_parm *p = t; - struct ip_tunnel_6rd ip6rd = {}; + struct ip_tunnel_6rd ip6rd = {0}; SPRINT_BUF(b1); /* Do not use format_host() for local addr, @@ -310,7 +310,7 @@ static void print_tunnel(const void *t) : "any"); if (p->iph.protocol == IPPROTO_IPV6 && (p->i_flags & SIT_ISATAP)) { - struct ip_tunnel_prl prl[16] = {}; + struct ip_tunnel_prl prl[16] = {0}; int i; prl[0].datalen = sizeof(prl) - sizeof(prl[0]); @@ -433,7 +433,7 @@ static int do_show(int argc, char **argv) static int do_prl(int argc, char **argv) { - struct ip_tunnel_prl p = {}; + struct ip_tunnel_prl p = {0}; int count = 0; int cmd = 0; const char *medium = NULL; @@ -482,7 +482,7 @@ static int do_prl(int argc, char **argv) static int do_6rd(int argc, char **argv) { - struct ip_tunnel_6rd ip6rd = {}; + struct ip_tunnel_6rd ip6rd = {0}; int cmd = 0; const char *medium = NULL; inet_prefix prefix; diff --git a/ip/iptuntap.c b/ip/iptuntap.c index 91d3512b..f1bf0b18 100644 --- a/ip/iptuntap.c +++ b/ip/iptuntap.c @@ -290,7 +290,7 @@ static char *pid_name(pid_t pid) static void show_processes(const char *name) { - glob_t globbuf = { }; + glob_t globbuf = {0}; char **fd_path; int err; diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c index 55d38d65..a2427bbf 100644 --- a/ip/ipxfrm.c +++ b/ip/ipxfrm.c @@ -903,7 +903,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, static int xfrm_selector_iszero(struct xfrm_selector *s) { - struct xfrm_selector s0 = {}; + struct xfrm_selector s0 = {0}; return (memcmp(&s0, s, sizeof(s0)) == 0); } @@ -912,7 +912,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo, struct rtattr *tb[], FILE *fp, const char *prefix, const char *title, bool nokeys) { - char buf[STRBUF_SIZE] = {}; + char buf[STRBUF_SIZE] = {0}; int force_spi = xfrm_xfrmproto_is_ipsec(xsinfo->id.proto); xfrm_id_info_print(&xsinfo->saddr, &xsinfo->id, xsinfo->mode, @@ -991,7 +991,7 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo, struct rtattr *tb[], FILE *fp, const char *prefix, const char *title) { - char buf[STRBUF_SIZE] = {}; + char buf[STRBUF_SIZE] = {0}; xfrm_selector_print(&xpinfo->sel, preferred_family, fp, title); @@ -1092,8 +1092,8 @@ int xfrm_id_parse(xfrm_address_t *saddr, struct xfrm_id *id, __u16 *family, { int argc = *argcp; char **argv = *argvp; - inet_prefix dst = {}; - inet_prefix src = {}; + inet_prefix dst = {0}; + inet_prefix src = {0}; while (1) { if (strcmp(*argv, "src") == 0) { @@ -1398,8 +1398,8 @@ int xfrm_selector_parse(struct xfrm_selector *sel, int *argcp, char ***argvp) { int argc = *argcp; char **argv = *argvp; - inet_prefix dst = {}; - inet_prefix src = {}; + inet_prefix dst = {0}; + inet_prefix src = {0}; char *upspecp = NULL; while (1) { diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index 7c0233c1..9fa11464 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -271,14 +271,14 @@ static int xfrm_policy_modify(int cmd, unsigned int flags, int argc, char **argv char *selp = NULL; char *ptypep = NULL; char *sctxp = NULL; - struct xfrm_userpolicy_type upt = {}; - char tmpls_buf[XFRM_TMPLS_BUF_SIZE] = {}; + struct xfrm_userpolicy_type upt = {0}; + char tmpls_buf[XFRM_TMPLS_BUF_SIZE] = {0}; int tmpls_len = 0; struct xfrm_mark mark = {0, 0}; struct { struct xfrm_user_sec_ctx sctx; char str[CTX_BUF_SIZE]; - } ctx = {}; + } ctx = {0}; bool is_if_id_set = false; __u32 if_id = 0; @@ -591,12 +591,12 @@ static int xfrm_policy_get_or_delete(int argc, char **argv, int delete, char *indexp = NULL; char *ptypep = NULL; char *sctxp = NULL; - struct xfrm_userpolicy_type upt = {}; + struct xfrm_userpolicy_type upt = {0}; struct xfrm_mark mark = {0, 0}; struct { struct xfrm_user_sec_ctx sctx; char str[CTX_BUF_SIZE]; - } ctx = {}; + } ctx = {0}; while (argc > 0) { if (strcmp(*argv, "dir") == 0) { @@ -1136,7 +1136,7 @@ static int xfrm_policy_flush(int argc, char **argv) .n.nlmsg_type = XFRM_MSG_FLUSHPOLICY, }; char *ptypep = NULL; - struct xfrm_userpolicy_type upt = {}; + struct xfrm_userpolicy_type upt = {0}; while (argc > 0) { if (strcmp(*argv, "ptype") == 0) { diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index b03ccc58..1e1c58f5 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -323,9 +323,9 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) .xsinfo.lft.soft_packet_limit = XFRM_INF, .xsinfo.lft.hard_packet_limit = XFRM_INF, }; - struct xfrm_replay_state replay = {}; - struct xfrm_replay_state_esn replay_esn = {}; - struct xfrm_user_offload xuo = {}; + struct xfrm_replay_state replay = {0}; + struct xfrm_replay_state_esn replay_esn = {0}; + struct xfrm_user_offload xuo = {0}; unsigned int ifindex = 0; __u8 dir = 0; bool is_offload = false; @@ -343,7 +343,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) struct { struct xfrm_user_sec_ctx sctx; char str[CTX_BUF_SIZE]; - } ctx = {}; + } ctx = {0}; __u32 output_mark = 0; bool is_if_id_set = false; __u32 if_id = 0; @@ -412,7 +412,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) (void *)&encap, sizeof(encap)); } else if (strcmp(*argv, "coa") == 0) { inet_prefix coa; - xfrm_address_t xcoa = {}; + xfrm_address_t xcoa = {0}; if (coap) duparg("coa", *argv); @@ -490,7 +490,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv) struct xfrm_algo_auth auth; } u; char buf[XFRM_ALGO_KEY_BUF_SIZE]; - } alg = {}; + } alg = {0}; int len; __u32 icvlen, trunclen; char *name; diff --git a/lib/bpf.c b/lib/bpf.c index 10cf9bf4..f4ac5f16 100644 --- a/lib/bpf.c +++ b/lib/bpf.c @@ -148,7 +148,7 @@ static int bpf(int cmd, union bpf_attr *attr, unsigned int size) static int bpf_map_update(int fd, const void *key, const void *value, uint64_t flags) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.map_fd = fd; attr.key = bpf_ptr_to_u64(key); @@ -160,7 +160,7 @@ static int bpf_map_update(int fd, const void *key, const void *value, static int bpf_prog_fd_by_id(uint32_t id) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.prog_id = id; @@ -170,7 +170,7 @@ static int bpf_prog_fd_by_id(uint32_t id) static int bpf_prog_info_by_fd(int fd, struct bpf_prog_info *info, uint32_t *info_len) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; int ret; attr.info.bpf_fd = fd; @@ -187,7 +187,7 @@ static int bpf_prog_info_by_fd(int fd, struct bpf_prog_info *info, int bpf_dump_prog_info(FILE *f, uint32_t id) { - struct bpf_prog_info info = {}; + struct bpf_prog_info info = {0}; uint32_t len = sizeof(info); int fd, ret, dump_ok = 0; SPRINT_BUF(tmp); @@ -457,7 +457,7 @@ static int bpf_map_selfcheck_pinned(int fd, const struct bpf_elf_map *map, struct bpf_map_ext *ext, int length, enum bpf_prog_type type) { - struct bpf_elf_map tmp, zero = {}; + struct bpf_elf_map tmp, zero = {0}; int ret; ret = bpf_derive_elf_map_from_fdinfo(fd, &tmp, ext); @@ -518,7 +518,7 @@ static int bpf_mnt_fs(const char *target) static int bpf_mnt_check_target(const char *target) { - struct stat sb = {}; + struct stat sb = {0}; int ret; ret = stat(target, &sb); @@ -722,7 +722,7 @@ static int bpf_gen_slave(const char *base, const char *name, { char *bpf_lnk_dir = NULL; char *bpf_sub_dir = NULL; - struct stat sb = {}; + struct stat sb = {0}; int ret; ret = asprintf(&bpf_lnk_dir, "%s%s/", base, link); @@ -844,7 +844,7 @@ out: static int bpf_obj_get(const char *pathname, enum bpf_prog_type type) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; char tmp[PATH_MAX]; if (strlen(pathname) > 2 && pathname[0] == 'm' && @@ -1015,7 +1015,7 @@ int bpf_load_common(struct bpf_cfg_in *cfg, const struct bpf_cfg_ops *ops, int bpf_parse_common(struct bpf_cfg_in *cfg, const struct bpf_cfg_ops *ops) { - bool opt_tbl[BPF_MODE_MAX] = {}; + bool opt_tbl[BPF_MODE_MAX] = {0}; if (ops->cbpf_cb) { opt_tbl[CBPF_BYTECODE] = true; @@ -1058,7 +1058,7 @@ int bpf_graft_map(const char *map_path, uint32_t *key, int argc, char **argv) .argc = argc, .argv = argv, }; - struct bpf_map_ext ext = {}; + struct bpf_map_ext ext = {0}; int ret, prog_fd, map_fd; uint32_t map_key; @@ -1111,7 +1111,7 @@ out_prog: int bpf_prog_attach_fd(int prog_fd, int target_fd, enum bpf_attach_type type) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.target_fd = target_fd; attr.attach_bpf_fd = prog_fd; @@ -1122,7 +1122,7 @@ int bpf_prog_attach_fd(int prog_fd, int target_fd, enum bpf_attach_type type) int bpf_prog_detach_fd(int target_fd, enum bpf_attach_type type) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.target_fd = target_fd; attr.attach_type = type; @@ -1135,7 +1135,7 @@ static int bpf_prog_load_dev(enum bpf_prog_type type, const char *license, __u32 ifindex, char *log, size_t size_log) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.prog_type = type; attr.insns = bpf_ptr_to_u64(insns); @@ -1298,7 +1298,7 @@ static int bpf_map_create(enum bpf_map_type type, uint32_t size_key, uint32_t ifindex, uint32_t btf_id_key, uint32_t btf_id_val) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.map_type = type; attr.key_size = size_key; @@ -1317,7 +1317,7 @@ static int bpf_map_create(enum bpf_map_type type, uint32_t size_key, static int bpf_btf_load(void *btf, size_t size_btf, char *log, size_t size_log) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.btf = bpf_ptr_to_u64(btf); attr.btf_size = size_btf; @@ -1333,7 +1333,7 @@ static int bpf_btf_load(void *btf, size_t size_btf, static int bpf_obj_pin(int fd, const char *pathname) { - union bpf_attr attr = {}; + union bpf_attr attr = {0}; attr.pathname = bpf_ptr_to_u64(pathname); attr.bpf_fd = fd; @@ -2039,7 +2039,7 @@ static int bpf_map_verify_all_offs(struct bpf_elf_ctx *ctx, int end) static int bpf_fetch_maps_end(struct bpf_elf_ctx *ctx) { - struct bpf_elf_map fixup[ARRAY_SIZE(ctx->maps)] = {}; + struct bpf_elf_map fixup[ARRAY_SIZE(ctx->maps)] = {0}; int i, sym_num = bpf_map_num_sym(ctx); __u8 *buff; @@ -2545,7 +2545,7 @@ static int bpf_fetch_prog_relo(struct bpf_elf_ctx *ctx, const char *section, int ret, idx, i, fd = -1; for (i = 1; i < ctx->elf_hdr.e_shnum; i++) { - struct bpf_relo_props props = {}; + struct bpf_relo_props props = {0}; ret = bpf_fill_section_data(ctx, i, &data_relo); if (ret < 0 || data_relo.sec_hdr.sh_type != SHT_REL) @@ -2729,7 +2729,7 @@ static int bpf_fill_prog_arrays(struct bpf_elf_ctx *ctx) ret = bpf_map_update(ctx->map_fds[idx], &key_id, &fd, BPF_ANY); if (ret < 0) { - struct bpf_jited_aux aux = {}; + struct bpf_jited_aux aux = {0}; ret = -errno; if (errno == E2BIG) { @@ -2820,7 +2820,7 @@ static bool bpf_pinning_reserved(uint32_t pinning) static void bpf_hash_init(struct bpf_elf_ctx *ctx, const char *db_file) { struct bpf_hash_entry *entry; - char subpath[PATH_MAX] = {}; + char subpath[PATH_MAX] = {0}; uint32_t pinning; FILE *fp; int ret; @@ -2918,7 +2918,7 @@ static void bpf_get_cfg(struct bpf_elf_ctx *ctx) fd = open(path_jit, O_RDONLY); if (fd > 0) { - char tmp[16] = {}; + char tmp[16] = {0}; if (read(fd, tmp, sizeof(tmp)) > 0) ctx->cfg.jit_enabled = atoi(tmp); diff --git a/lib/libnetlink.c b/lib/libnetlink.c index 48b19501..5345b1c7 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -81,7 +81,7 @@ static void print_ext_ack_msg(bool is_err, const char *msg) /* dump netlink extended ack error message */ int nl_dump_ext_ack(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn) { - struct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {}; + struct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {0}; const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh); const struct nlmsghdr *err_nlh = NULL; unsigned int hlen = sizeof(*err); @@ -128,7 +128,7 @@ int nl_dump_ext_ack(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn) int nl_dump_ext_ack_done(const struct nlmsghdr *nlh, int error) { - struct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {}; + struct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {0}; unsigned int hlen = sizeof(int); const char *msg = NULL; diff --git a/lib/ll_map.c b/lib/ll_map.c index 70ea3d49..36320f77 100644 --- a/lib/ll_map.c +++ b/lib/ll_map.c @@ -279,7 +279,7 @@ static int ll_link_get(const char *name, int index) .ifm.ifi_index = index, }; __u32 filt_mask = RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS; - struct rtnl_handle rth = {}; + struct rtnl_handle rth = {0}; struct nlmsghdr *answer; int rc = 0; diff --git a/misc/arpd.c b/misc/arpd.c index 504961cb..ac412e29 100644 --- a/misc/arpd.c +++ b/misc/arpd.c @@ -435,7 +435,7 @@ static void get_kern_msg(void) { int status; struct nlmsghdr *h; - struct sockaddr_nl nladdr = {}; + struct sockaddr_nl nladdr = {0}; struct iovec iov; char buf[8192]; struct msghdr msg = { @@ -659,7 +659,7 @@ int main(int argc, char **argv) if (ifnum) { int i; - struct ifreq ifr = {}; + struct ifreq ifr = {0}; for (i = 0; i < ifnum; i++) { if (get_ifname(ifr.ifr_name, ifnames[i])) diff --git a/misc/ss.c b/misc/ss.c index 1e8bca5a..01a2cda5 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -2617,7 +2617,7 @@ static void sctp_timer_print(struct tcpstat *s) static int tcp_show_line(char *line, const struct filter *f, int family) { int rto = 0, ato = 0; - struct tcpstat s = {}; + struct tcpstat s = {0}; char *loc, *rem, *data; char opt[256]; int n; @@ -2831,7 +2831,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r, struct rtattr *tb[]) { double rtt = 0; - struct tcpstat s = {}; + struct tcpstat s = {0}; s.ss.state = r->idiag_state; @@ -3117,7 +3117,7 @@ static int inet_show_sock(struct nlmsghdr *nlh, inet_stats_print(s, v6only); if (show_options) { - struct tcpstat t = {}; + struct tcpstat t = {0}; t.timer = r->idiag_timer; t.timeout = r->idiag_expires; @@ -3339,7 +3339,7 @@ static int show_one_inet_sock(struct nlmsghdr *h, void *arg) int err; struct inet_diag_arg *diag_arg = arg; struct inet_diag_msg *r = NLMSG_DATA(h); - struct sockstat s = {}; + struct sockstat s = {0}; if (!(diag_arg->f->families & FAMILY_MASK(r->idiag_family))) return 0; @@ -3428,7 +3428,7 @@ static int tcp_show_netlink_file(struct filter *f) int err2; size_t status, nitems; struct nlmsghdr *h = (struct nlmsghdr *)buf; - struct sockstat s = {}; + struct sockstat s = {0}; status = fread(buf, 1, sizeof(*h), fp); if (status != sizeof(*h)) { @@ -3573,7 +3573,7 @@ static int sctp_show(struct filter *f) static int dgram_show_line(char *line, const struct filter *f, int family) { - struct sockstat s = {}; + struct sockstat s = {0}; char *loc, *rem, *data; char opt[256]; int n; @@ -3713,7 +3713,7 @@ static bool unix_type_skip(struct sockstat *s, struct filter *f) static void unix_stats_print(struct sockstat *s, struct filter *f) { - char port_name[30] = {}; + char port_name[30] = {0}; sock_state_print(s); @@ -4026,7 +4026,7 @@ static int packet_show_sock(struct nlmsghdr *nlh, void *arg) struct packet_diag_info *pinfo = NULL; struct packet_diag_ring *ring_rx = NULL, *ring_tx = NULL; struct rtattr *tb[PACKET_DIAG_MAX+1]; - struct sockstat stat = {}; + struct sockstat stat = {0}; uint32_t fanout = 0; bool has_fanout = false; @@ -4175,7 +4175,7 @@ static int packet_show_netlink(struct filter *f) static int packet_show_line(char *buf, const struct filter *f, int fam) { unsigned long long sk; - struct sockstat stat = {}; + struct sockstat stat = {0}; int type, prot, iface, state, rq, uid, ino; sscanf(buf, "%llx %*d %d %x %d %d %u %u %u", @@ -4299,7 +4299,7 @@ static int xdp_show_sock(struct nlmsghdr *nlh, void *arg) struct xdp_diag_info *info = NULL; struct xdp_diag_umem *umem = NULL; const struct filter *f = arg; - struct sockstat stat = {}; + struct sockstat stat = {0}; parse_rtattr(tb, XDP_DIAG_MAX, (struct rtattr *)(msg + 1), nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*msg))); @@ -4380,9 +4380,9 @@ static int netlink_show_one(struct filter *f, .remote.family = AF_NETLINK, }; - SPRINT_BUF(prot_buf) = {}; + SPRINT_BUF(prot_buf) = {0}; const char *prot_name; - char procname[64] = {}; + char procname[64] = {0}; if (f->f) { st.rport = -1; @@ -4629,8 +4629,8 @@ static void tipc_sock_addr_print(struct rtattr *net_addr, struct rtattr *id) uint32_t node = rta_getattr_u32(net_addr); uint32_t identity = rta_getattr_u32(id); - SPRINT_BUF(addr) = {}; - SPRINT_BUF(port) = {}; + SPRINT_BUF(addr) = {0}; + SPRINT_BUF(port) = {0}; sprintf(addr, "%u", node); sprintf(port, "%u", identity); @@ -4640,12 +4640,12 @@ static void tipc_sock_addr_print(struct rtattr *net_addr, struct rtattr *id) static int tipc_show_sock(struct nlmsghdr *nlh, void *arg) { - struct rtattr *stat[TIPC_NLA_SOCK_STAT_MAX + 1] = {}; - struct rtattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {}; - struct rtattr *con[TIPC_NLA_CON_MAX + 1] = {}; - struct rtattr *info[TIPC_NLA_MAX + 1] = {}; + struct rtattr *stat[TIPC_NLA_SOCK_STAT_MAX + 1] = {0}; + struct rtattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {0}; + struct rtattr *con[TIPC_NLA_CON_MAX + 1] = {0}; + struct rtattr *info[TIPC_NLA_MAX + 1] = {0}; struct rtattr *msg_ref; - struct sockstat ss = {}; + struct sockstat ss = {0}; parse_rtattr(info, TIPC_NLA_MAX, NLMSG_DATA(nlh), NLMSG_PAYLOAD(nlh, 0)); diff --git a/rdma/dev.c b/rdma/dev.c index a11081b8..27290218 100644 --- a/rdma/dev.c +++ b/rdma/dev.c @@ -191,7 +191,7 @@ static void dev_print_node_type(struct rd *rd, struct nlattr **tb) static int dev_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; diff --git a/rdma/link.c b/rdma/link.c index bf24b849..620485f1 100644 --- a/rdma/link.c +++ b/rdma/link.c @@ -224,7 +224,7 @@ static void link_print_netdev(struct rd *rd, struct nlattr **tb) static int link_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; uint32_t port, idx; const char *name; diff --git a/rdma/rdma.c b/rdma/rdma.c index 22050555..9007a550 100644 --- a/rdma/rdma.c +++ b/rdma/rdma.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) bool show_details = false; bool json_output = false; bool force = false; - struct rd rd = {}; + struct rd rd = {0}; char *filename; int opt; int err; diff --git a/rdma/res-cmid.c b/rdma/res-cmid.c index f167800f..59c68495 100644 --- a/rdma/res-cmid.c +++ b/rdma/res-cmid.c @@ -212,7 +212,7 @@ out: if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) int res_cm_id_idx_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; int idx; @@ -229,7 +229,7 @@ int res_cm_id_idx_parse_cb(const struct nlmsghdr *nlh, void *data) int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct nlattr *nla_table, *nla_entry; struct rd *rd = data; int ret = MNL_CB_OK; @@ -246,7 +246,7 @@ int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data) nla_table = tb[RDMA_NLDEV_ATTR_RES_CM_ID]; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; ret = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (ret != MNL_CB_OK) diff --git a/rdma/res-cq.c b/rdma/res-cq.c index e1efe3ba..d3fd01fb 100644 --- a/rdma/res-cq.c +++ b/rdma/res-cq.c @@ -116,7 +116,7 @@ out: if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) int res_cq_idx_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; @@ -133,7 +133,7 @@ int res_cq_idx_parse_cb(const struct nlmsghdr *nlh, void *data) int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct nlattr *nla_table, *nla_entry; struct rd *rd = data; int ret = MNL_CB_OK; @@ -150,7 +150,7 @@ int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data) nla_table = tb[RDMA_NLDEV_ATTR_RES_CQ]; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; ret = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (ret != MNL_CB_OK) diff --git a/rdma/res-mr.c b/rdma/res-mr.c index c1366035..2b19a5d7 100644 --- a/rdma/res-mr.c +++ b/rdma/res-mr.c @@ -79,7 +79,7 @@ out: int res_mr_idx_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; @@ -96,7 +96,7 @@ int res_mr_idx_parse_cb(const struct nlmsghdr *nlh, void *data) int res_mr_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct nlattr *nla_table, *nla_entry; struct rd *rd = data; int ret = MNL_CB_OK; @@ -113,7 +113,7 @@ int res_mr_parse_cb(const struct nlmsghdr *nlh, void *data) nla_table = tb[RDMA_NLDEV_ATTR_RES_MR]; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; ret = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (ret != MNL_CB_OK) diff --git a/rdma/res-pd.c b/rdma/res-pd.c index df538010..6179d788 100644 --- a/rdma/res-pd.c +++ b/rdma/res-pd.c @@ -83,7 +83,7 @@ out: if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) int res_pd_idx_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; @@ -100,7 +100,7 @@ int res_pd_idx_parse_cb(const struct nlmsghdr *nlh, void *data) int res_pd_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct nlattr *nla_table, *nla_entry; struct rd *rd = data; int ret = MNL_CB_OK; @@ -117,7 +117,7 @@ int res_pd_parse_cb(const struct nlmsghdr *nlh, void *data) nla_table = tb[RDMA_NLDEV_ATTR_RES_PD]; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; ret = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (ret != MNL_CB_OK) diff --git a/rdma/res-qp.c b/rdma/res-qp.c index 801cfca9..e01e94ff 100644 --- a/rdma/res-qp.c +++ b/rdma/res-qp.c @@ -172,7 +172,7 @@ out: int res_qp_idx_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; @@ -189,7 +189,7 @@ int res_qp_idx_parse_cb(const struct nlmsghdr *nlh, void *data) int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct nlattr *nla_table, *nla_entry; struct rd *rd = data; int ret = MNL_CB_OK; @@ -206,7 +206,7 @@ int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data) nla_table = tb[RDMA_NLDEV_ATTR_RES_QP]; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; ret = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (ret != MNL_CB_OK) diff --git a/rdma/res.c b/rdma/res.c index 251f5041..7eee7e0f 100644 --- a/rdma/res.c +++ b/rdma/res.c @@ -34,7 +34,7 @@ static int res_print_summary(struct rd *rd, struct nlattr **tb) int err; mnl_attr_for_each_nested(nla_entry, nla_table) { - struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {0}; err = mnl_attr_parse_nested(nla_entry, rd_attr_cb, nla_line); if (err != MNL_CB_OK) @@ -61,7 +61,7 @@ static int res_no_args_idx_parse_cb(const struct nlmsghdr *nlh, void *data) static int res_no_args_parse_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct rd *rd = data; const char *name; uint32_t idx; diff --git a/rdma/utils.c b/rdma/utils.c index e25c3adf..25648a30 100644 --- a/rdma/utils.c +++ b/rdma/utils.c @@ -488,7 +488,7 @@ int rd_attr_cb(const struct nlattr *attr, void *data) int rd_dev_init_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {}; + struct nlattr *tb[RDMA_NLDEV_ATTR_MAX] = {0}; struct dev_map *dev_map; struct rd *rd = data; const char *dev_name; diff --git a/tc/e_bpf.c b/tc/e_bpf.c index a48393b7..6fbcd339 100644 --- a/tc/e_bpf.c +++ b/tc/e_bpf.c @@ -58,8 +58,8 @@ static int parse_bpf(struct exec_util *eu, int argc, char **argv) char **argv_run = argv_default, **envp_run, *tmp; int ret, i, env_old, env_num, env_map; const char *bpf_uds_name = NULL; - int fds[BPF_SCM_MAX_FDS] = {}; - struct bpf_map_aux aux = {}; + int fds[BPF_SCM_MAX_FDS] = {0}; + struct bpf_map_aux aux = {0}; if (argc == 0) return 0; diff --git a/tc/em_cmp.c b/tc/em_cmp.c index e051656f..abe2cd93 100644 --- a/tc/em_cmp.c +++ b/tc/em_cmp.c @@ -43,7 +43,7 @@ static int cmp_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, int align, opnd = 0; unsigned long offset = 0, layer = TCF_LAYER_NETWORK, mask = 0, value = 0; int offset_present = 0, value_present = 0; - struct tcf_em_cmp cmp = {}; + struct tcf_em_cmp cmp = {0}; #define PARSE_ERR(CARG, FMT, ARGS...) \ em_parse_error(EINVAL, args, CARG, &cmp_ematch_util, FMT, ##ARGS) diff --git a/tc/em_ipset.c b/tc/em_ipset.c index 48b287f5..08d83401 100644 --- a/tc/em_ipset.c +++ b/tc/em_ipset.c @@ -198,7 +198,7 @@ static void ipset_print_usage(FILE *fd) static int ipset_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, struct bstr *args) { - struct xt_set_info set_info = {}; + struct xt_set_info set_info = {0}; int ret; #define PARSE_ERR(CARG, FMT, ARGS...) \ diff --git a/tc/em_meta.c b/tc/em_meta.c index 2ddc65ed..6d0755c5 100644 --- a/tc/em_meta.c +++ b/tc/em_meta.c @@ -360,7 +360,7 @@ static int meta_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, { int opnd; struct bstr *a; - struct tcf_meta_hdr meta_hdr = {}; + struct tcf_meta_hdr meta_hdr = {0}; unsigned long lvalue = 0, rvalue = 0; if (args == NULL) diff --git a/tc/em_nbyte.c b/tc/em_nbyte.c index 274d713f..1e72bdf4 100644 --- a/tc/em_nbyte.c +++ b/tc/em_nbyte.c @@ -43,7 +43,7 @@ static int nbyte_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, struct bstr *needle = args; unsigned long offset = 0, layer = TCF_LAYER_NETWORK; int offset_present = 0; - struct tcf_em_nbyte nb = {}; + struct tcf_em_nbyte nb = {0}; #define PARSE_ERR(CARG, FMT, ARGS...) \ em_parse_error(EINVAL, args, CARG, &nbyte_ematch_util, FMT, ##ARGS) diff --git a/tc/em_u32.c b/tc/em_u32.c index bc284af4..efebb2dc 100644 --- a/tc/em_u32.c +++ b/tc/em_u32.c @@ -38,7 +38,7 @@ static int u32_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr, struct bstr *a; int align, nh_len; unsigned long key, mask, offmask = 0, offset; - struct tc_u32_key u_key = {}; + struct tc_u32_key u_key = {0}; #define PARSE_ERR(CARG, FMT, ARGS...) \ em_parse_error(EINVAL, args, CARG, &u32_ematch_util, FMT, ##ARGS) diff --git a/tc/f_bpf.c b/tc/f_bpf.c index 135271aa..a9523d0f 100644 --- a/tc/f_bpf.c +++ b/tc/f_bpf.c @@ -82,7 +82,7 @@ static int bpf_parse_opt(struct filter_util *qu, char *handle, struct tcmsg *t = NLMSG_DATA(n); unsigned int bpf_gen_flags = 0; unsigned int bpf_flags = 0; - struct bpf_cfg_in cfg = {}; + struct bpf_cfg_in cfg = {0}; bool seen_run = false; bool skip_sw = false; struct rtattr *tail; diff --git a/tc/f_fw.c b/tc/f_fw.c index 688364f5..55fcc3cc 100644 --- a/tc/f_fw.c +++ b/tc/f_fw.c @@ -93,7 +93,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a } continue; } else if (strcmp(*argv, "indev") == 0) { - char d[IFNAMSIZ+1] = {}; + char d[IFNAMSIZ+1] = {0}; argc--; argv++; diff --git a/tc/f_rsvp.c b/tc/f_rsvp.c index 388e9ee5..e6eb0147 100644 --- a/tc/f_rsvp.c +++ b/tc/f_rsvp.c @@ -174,7 +174,7 @@ static int rsvp_parse_opt(struct filter_util *qu, char *handle, int argc, char **argv, struct nlmsghdr *n) { int family = strcmp(qu->id, "rsvp") == 0 ? AF_INET : AF_INET6; - struct tc_rsvp_pinfo pinfo = {}; + struct tc_rsvp_pinfo pinfo = {0}; struct tcmsg *t = NLMSG_DATA(n); int pinfo_ok = 0; struct rtattr *tail; diff --git a/tc/f_u32.c b/tc/f_u32.c index e0a322d5..483c4685 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -984,7 +984,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, struct { struct tc_u32_sel sel; struct tc_u32_key keys[128]; - } sel = {}; + } sel = {0}; struct tcmsg *t = NLMSG_DATA(n); struct rtattr *tail; int sel_ok = 0, terminal_ok = 0; @@ -1089,7 +1089,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, struct { struct tc_u32_sel sel; struct tc_u32_key keys[4]; - } sel2 = {}; + } sel2 = {0}; NEXT_ARG(); if (parse_selector(&argc, &argv, &sel2.sel, n)) { @@ -1117,7 +1117,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, sample_ok = 1; continue; } else if (strcmp(*argv, "indev") == 0) { - char ind[IFNAMSIZ + 1] = {}; + char ind[IFNAMSIZ + 1] = {0}; argc--; argv++; diff --git a/tc/m_bpf.c b/tc/m_bpf.c index e8d704b5..7ecd86ef 100644 --- a/tc/m_bpf.c +++ b/tc/m_bpf.c @@ -77,8 +77,8 @@ static int bpf_parse_opt(struct action_util *a, int *ptr_argc, char ***ptr_argv, int tca_id, struct nlmsghdr *n) { const char *bpf_obj = NULL, *bpf_uds_name = NULL; - struct tc_act_bpf parm = {}; - struct bpf_cfg_in cfg = {}; + struct tc_act_bpf parm = {0}; + struct bpf_cfg_in cfg = {0}; bool seen_run = false; struct rtattr *tail; int argc, ret = 0; diff --git a/tc/m_connmark.c b/tc/m_connmark.c index eac23489..dc353a44 100644 --- a/tc/m_connmark.c +++ b/tc/m_connmark.c @@ -46,7 +46,7 @@ static int parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct tc_connmark sel = {}; + struct tc_connmark sel = {0}; char **argv = *argv_p; int argc = *argc_p; int ok = 0; diff --git a/tc/m_csum.c b/tc/m_csum.c index 3e3dc251..c19d27f4 100644 --- a/tc/m_csum.c +++ b/tc/m_csum.c @@ -88,7 +88,7 @@ static int parse_csum(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct tc_csum sel = {}; + struct tc_csum sel = {0}; int argc = *argc_p; char **argv = *argv_p; diff --git a/tc/m_mirred.c b/tc/m_mirred.c index 13209523..c178d43b 100644 --- a/tc/m_mirred.c +++ b/tc/m_mirred.c @@ -96,9 +96,9 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p, int argc = *argc_p; char **argv = *argv_p; int ok = 0, iok = 0, mirror = 0, redir = 0, ingress = 0, egress = 0; - struct tc_mirred p = {}; + struct tc_mirred p = {0}; struct rtattr *tail; - char d[IFNAMSIZ] = {}; + char d[IFNAMSIZ] = {0}; while (argc > 0) { diff --git a/tc/m_nat.c b/tc/m_nat.c index c4b02a83..59af9894 100644 --- a/tc/m_nat.c +++ b/tc/m_nat.c @@ -83,7 +83,7 @@ bad_val: static int parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct tc_nat sel = {}; + struct tc_nat sel = {0}; int argc = *argc_p; char **argv = *argv_p; diff --git a/tc/m_pedit.c b/tc/m_pedit.c index 1cd2d162..1b714cea 100644 --- a/tc/m_pedit.c +++ b/tc/m_pedit.c @@ -511,7 +511,7 @@ done: static int parse_munge(int *argc_p, char ***argv_p, struct m_pedit_sel *sel) { - struct m_pedit_key tkey = {}; + struct m_pedit_key tkey = {0}; int argc = *argc_p; char **argv = *argv_p; int res = -1; @@ -615,7 +615,7 @@ static int pedit_keys_ex_addattr(struct m_pedit_sel *sel, struct nlmsghdr *n) static int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct m_pedit_sel sel = {}; + struct m_pedit_sel sel = {0}; int argc = *argc_p; char **argv = *argv_p; diff --git a/tc/m_simple.c b/tc/m_simple.c index 49e25047..2e645b08 100644 --- a/tc/m_simple.c +++ b/tc/m_simple.c @@ -97,7 +97,7 @@ static int parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct tc_defact sel = {}; + struct tc_defact sel = {0}; int argc = *argc_p; char **argv = *argv_p; int ok = 0; diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c index 4e65e444..7cbfdfe9 100644 --- a/tc/m_tunnel_key.c +++ b/tc/m_tunnel_key.c @@ -209,7 +209,7 @@ static int tunnel_key_parse_tos_ttl(char *str, int type, struct nlmsghdr *n) static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n) { - struct tc_tunnel_key parm = {}; + struct tc_tunnel_key parm = {0}; char **argv = *argv_p; int argc = *argc_p; struct rtattr *tail; diff --git a/tc/m_vlan.c b/tc/m_vlan.c index 9c8071e9..cdfe0d3d 100644 --- a/tc/m_vlan.c +++ b/tc/m_vlan.c @@ -69,7 +69,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, int proto_set = 0; __u8 prio; int prio_set = 0; - struct tc_vlan parm = {}; + struct tc_vlan parm = {0}; if (matches(*argv, "vlan") != 0) return -1; diff --git a/tc/m_xt.c b/tc/m_xt.c index bf0db2be..59255d5b 100644 --- a/tc/m_xt.c +++ b/tc/m_xt.c @@ -147,7 +147,7 @@ static int parse_ipt(struct action_util *a, int *argc_p, { struct xtables_target *m = NULL; #if XTABLES_VERSION_CODE >= 6 - struct ipt_entry fw = {}; + struct ipt_entry fw = {0}; #endif struct rtattr *tail; diff --git a/tc/q_atm.c b/tc/q_atm.c index 77b56825..c0acf492 100644 --- a/tc/q_atm.c +++ b/tc/q_atm.c @@ -49,7 +49,7 @@ static void explain(void) static int atm_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct sockaddr_atmsvc addr = {}; + struct sockaddr_atmsvc addr = {0}; struct atm_qos qos; struct atm_sap sap; unsigned char hdr[MAX_HDR_LEN]; diff --git a/tc/q_cbq.c b/tc/q_cbq.c index 6518ef46..9bee7c1b 100644 --- a/tc/q_cbq.c +++ b/tc/q_cbq.c @@ -50,8 +50,8 @@ static void explain1(char *arg) static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_ratespec r = {}; - struct tc_cbq_lssopt lss = {}; + struct tc_ratespec r = {0}; + struct tc_cbq_lssopt lss = {0}; __u32 rtab[256]; unsigned mpu = 0, avpkt = 0, allot = 0; unsigned short overhead = 0; @@ -185,10 +185,10 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int wrr_ok = 0, fopt_ok = 0; - struct tc_ratespec r = {}; - struct tc_cbq_lssopt lss = {}; - struct tc_cbq_wrropt wrr = {}; - struct tc_cbq_fopt fopt = {}; + struct tc_ratespec r = {0}; + struct tc_cbq_lssopt lss = {0}; + struct tc_cbq_wrropt wrr = {0}; + struct tc_cbq_fopt fopt = {0}; __u32 rtab[256]; unsigned mpu = 0; int cell_log = -1; diff --git a/tc/q_cbs.c b/tc/q_cbs.c index 13bb08e9..a32aa6c1 100644 --- a/tc/q_cbs.c +++ b/tc/q_cbs.c @@ -37,7 +37,7 @@ static void explain1(const char *arg, const char *val) static int cbs_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_cbs_qopt opt = {}; + struct tc_cbs_qopt opt = {0}; struct rtattr *tail; while (argc > 0) { diff --git a/tc/q_choke.c b/tc/q_choke.c index 570c3599..aa354d5d 100644 --- a/tc/q_choke.c +++ b/tc/q_choke.c @@ -34,7 +34,7 @@ static void explain(void) static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_red_qopt opt = {}; + struct tc_red_qopt opt = {0}; unsigned int burst = 0; unsigned int avpkt = 1000; double probability = 0.02; diff --git a/tc/q_codel.c b/tc/q_codel.c index c72a5779..a000bcdd 100644 --- a/tc/q_codel.c +++ b/tc/q_codel.c @@ -180,7 +180,7 @@ static int codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) static int codel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { - struct tc_codel_xstats _st = {}, *st; + struct tc_codel_xstats _st = {0}, *st; SPRINT_BUF(b1); diff --git a/tc/q_fifo.c b/tc/q_fifo.c index 61493fbb..b4fa76ae 100644 --- a/tc/q_fifo.c +++ b/tc/q_fifo.c @@ -31,7 +31,7 @@ static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0; - struct tc_fifo_qopt opt = {}; + struct tc_fifo_qopt opt = {0}; while (argc > 0) { if (strcmp(*argv, "limit") == 0) { diff --git a/tc/q_fq_codel.c b/tc/q_fq_codel.c index d002940d..2bace6de 100644 --- a/tc/q_fq_codel.c +++ b/tc/q_fq_codel.c @@ -227,7 +227,7 @@ static int fq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt static int fq_codel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) { - struct tc_fq_codel_xstats _st = {}, *st; + struct tc_fq_codel_xstats _st = {0}, *st; SPRINT_BUF(b1); diff --git a/tc/q_gred.c b/tc/q_gred.c index 8a1cecff..7a39281f 100644 --- a/tc/q_gred.c +++ b/tc/q_gred.c @@ -304,8 +304,8 @@ gred_parse_vqs(struct tc_gred_info *info, struct rtattr *vqs) unsigned int offset = 0; while (rem > offset) { - struct rtattr *tb_entry[TCA_GRED_VQ_ENTRY_MAX + 1] = {}; - struct rtattr *tb[TCA_GRED_VQ_MAX + 1] = {}; + struct rtattr *tb_entry[TCA_GRED_VQ_ENTRY_MAX + 1] = {0}; + struct rtattr *tb[TCA_GRED_VQ_MAX + 1] = {0}; struct rtattr *entry; unsigned int len; unsigned int dp; @@ -422,7 +422,7 @@ gred_print_stats(struct tc_gred_info *info, struct tc_gred_qopt *qopt) static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) { - struct tc_gred_info infos[MAX_DPs] = {}; + struct tc_gred_info infos[MAX_DPs] = {0}; struct rtattr *tb[TCA_GRED_MAX + 1]; struct tc_gred_sopt *sopt; struct tc_gred_qopt *qopt; diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c index f34b1b2f..9612df40 100644 --- a/tc/q_hfsc.c +++ b/tc/q_hfsc.c @@ -73,7 +73,7 @@ static int hfsc_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_hfsc_qopt qopt = {}; + struct tc_hfsc_qopt qopt = {0}; while (argc > 0) { if (matches(*argv, "default") == 0) { @@ -144,7 +144,7 @@ static int hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_service_curve rsc = {}, fsc = {}, usc = {}; + struct tc_service_curve rsc = {0}, fsc = {}, usc = {}; int rsc_ok = 0, fsc_ok = 0, usc_ok = 0; struct rtattr *tail; diff --git a/tc/q_htb.c b/tc/q_htb.c index 52052226..2806c7f1 100644 --- a/tc/q_htb.c +++ b/tc/q_htb.c @@ -109,7 +109,7 @@ static int htb_parse_opt(struct qdisc_util *qu, int argc, static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_htb_opt opt = {}; + struct tc_htb_opt opt = {0}; __u32 rtab[256], ctab[256]; unsigned buffer = 0, cbuffer = 0; int cell_log = -1, ccell_log = -1; diff --git a/tc/q_multiq.c b/tc/q_multiq.c index 8ad9e0b2..7319b1bf 100644 --- a/tc/q_multiq.c +++ b/tc/q_multiq.c @@ -42,7 +42,7 @@ static void explain(void) static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_multiq_qopt opt = {}; + struct tc_multiq_qopt opt = {0}; if (argc) { if (strcmp(*argv, "help") == 0) { diff --git a/tc/q_netem.c b/tc/q_netem.c index d01450fc..42677a29 100644 --- a/tc/q_netem.c +++ b/tc/q_netem.c @@ -200,17 +200,17 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, int slot_dist_size = 0; struct rtattr *tail; struct tc_netem_qopt opt = { .limit = 1000 }; - struct tc_netem_corr cor = {}; - struct tc_netem_reorder reorder = {}; - struct tc_netem_corrupt corrupt = {}; + struct tc_netem_corr cor = {0}; + struct tc_netem_reorder reorder = {0}; + struct tc_netem_corrupt corrupt = {0}; struct tc_netem_gimodel gimodel; struct tc_netem_gemodel gemodel; - struct tc_netem_rate rate = {}; - struct tc_netem_slot slot = {}; + struct tc_netem_rate rate = {0}; + struct tc_netem_slot slot = {0}; __s16 *dist_data = NULL; __s16 *slot_dist_data = NULL; __u16 loss_type = NETEM_LOSS_UNSPEC; - int present[__TCA_NETEM_MAX] = {}; + int present[__TCA_NETEM_MAX] = {0}; __u64 rate64 = 0; for ( ; argc > 0; --argc, ++argv) { diff --git a/tc/q_red.c b/tc/q_red.c index 6256420f..13e68714 100644 --- a/tc/q_red.c +++ b/tc/q_red.c @@ -36,7 +36,7 @@ static void explain(void) static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { - struct tc_red_qopt opt = {}; + struct tc_red_qopt opt = {0}; unsigned int burst = 0; unsigned int avpkt = 0; double probability = 0.02; diff --git a/tc/q_sfq.c b/tc/q_sfq.c index 2b9bbcd2..a0b84f41 100644 --- a/tc/q_sfq.c +++ b/tc/q_sfq.c @@ -38,7 +38,7 @@ static void explain(void) static int sfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0, red = 0; - struct tc_sfq_qopt_v1 opt = {}; + struct tc_sfq_qopt_v1 opt = {0}; unsigned int burst = 0; int wlog; unsigned int avpkt = 1000; diff --git a/tc/q_skbprio.c b/tc/q_skbprio.c index ca81a72c..c792ebf0 100644 --- a/tc/q_skbprio.c +++ b/tc/q_skbprio.c @@ -32,7 +32,7 @@ static int skbprio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0; - struct tc_skbprio_qopt opt = {}; + struct tc_skbprio_qopt opt = {0}; while (argc > 0) { if (strcmp(*argv, "limit") == 0) { diff --git a/tc/q_tbf.c b/tc/q_tbf.c index 5135b1d6..9bbe6b37 100644 --- a/tc/q_tbf.c +++ b/tc/q_tbf.c @@ -40,7 +40,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) { int ok = 0; - struct tc_tbf_qopt opt = {}; + struct tc_tbf_qopt opt = {0}; __u32 rtab[256]; __u32 ptab[256]; unsigned buffer = 0, mtu = 0, mpu = 0, latency = 0; diff --git a/tc/tc_class.c b/tc/tc_class.c index c7e3cfdf..2ef4765b 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -36,8 +36,8 @@ struct graph_node { int nodes_count; }; -static struct hlist_head cls_list = {}; -static struct hlist_head root_cls_list = {}; +static struct hlist_head cls_list = {0}; +static struct hlist_head root_cls_list = {0}; static void usage(void); @@ -67,9 +67,9 @@ static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv) .t.tcm_family = AF_UNSPEC, }; struct qdisc_util *q = NULL; - struct tc_estimator est = {}; - char d[IFNAMSIZ] = {}; - char k[FILTER_NAMESZ] = {}; + struct tc_estimator est = {0}; + char d[IFNAMSIZ] = {0}; + char k[FILTER_NAMESZ] = {0}; while (argc > 0) { if (strcmp(*argv, "dev") == 0) { @@ -216,14 +216,14 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, int level) { struct hlist_node *n, *tmp_cls; - char cls_id_str[256] = {}; + char cls_id_str[256] = {0}; struct rtattr *tb[TCA_MAX + 1]; struct qdisc_util *q; - char str[300] = {}; + char str[300] = {0}; hlist_for_each_safe(n, tmp_cls, root_list) { struct hlist_node *c, *tmp_chld; - struct hlist_head children = {}; + struct hlist_head children = {0}; struct graph_node *cls = container_of(n, struct graph_node, hlist); @@ -388,7 +388,7 @@ int print_class(struct nlmsghdr *n, void *arg) static int tc_class_list(int argc, char **argv) { struct tcmsg t = { .tcm_family = AF_UNSPEC }; - char d[IFNAMSIZ] = {}; + char d[IFNAMSIZ] = {0}; char buf[1024] = {0}; filter_qdisc = 0; diff --git a/tc/tc_exec.c b/tc/tc_exec.c index 9b912ceb..edc6c205 100644 --- a/tc/tc_exec.c +++ b/tc/tc_exec.c @@ -85,7 +85,7 @@ noexist: int do_exec(int argc, char **argv) { struct exec_util *eu; - char kind[FILTER_NAMESZ] = {}; + char kind[FILTER_NAMESZ] = {0}; if (argc < 1) { fprintf(stderr, "No command given, try \"tc exec help\".\n"); diff --git a/tc/tc_filter.c b/tc/tc_filter.c index f7d2e4a6..347c1be4 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -78,9 +78,9 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv) __u32 chain_index; int chain_index_set = 0; char *fhandle = NULL; - char d[IFNAMSIZ] = {}; - char k[FILTER_NAMESZ] = {}; - struct tc_estimator est = {}; + char d[IFNAMSIZ] = {0}; + char k[FILTER_NAMESZ] = {0}; + struct tc_estimator est = {0}; if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE) protocol = htons(ETH_P_ALL); @@ -405,8 +405,8 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) __u32 block_index = 0; __u32 parent_handle = 0; char *fhandle = NULL; - char d[IFNAMSIZ] = {}; - char k[FILTER_NAMESZ] = {}; + char d[IFNAMSIZ] = {0}; + char k[FILTER_NAMESZ] = {0}; while (argc > 0) { if (strcmp(*argv, "dev") == 0) { @@ -595,7 +595,7 @@ static int tc_filter_list(int cmd, int argc, char **argv) .t.tcm_parent = TC_H_UNSPEC, .t.tcm_family = AF_UNSPEC, }; - char d[IFNAMSIZ] = {}; + char d[IFNAMSIZ] = {0}; __u32 prio = 0; __u32 protocol = 0; __u32 chain_index; diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index 17e39983..cda0a564 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -46,13 +46,13 @@ static int usage(void) static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv) { struct qdisc_util *q = NULL; - struct tc_estimator est = {}; + struct tc_estimator est = {0}; struct { struct tc_sizespec szopts; __u16 *data; - } stab = {}; - char d[IFNAMSIZ] = {}; - char k[FILTER_NAMESZ] = {}; + } stab = {0}; + char d[IFNAMSIZ] = {0}; + char k[FILTER_NAMESZ] = {0}; struct { struct nlmsghdr n; struct tcmsg t; @@ -345,7 +345,7 @@ int print_qdisc(struct nlmsghdr *n, void *arg) static int tc_qdisc_list(int argc, char **argv) { struct tcmsg t = { .tcm_family = AF_UNSPEC }; - char d[IFNAMSIZ] = {}; + char d[IFNAMSIZ] = {0}; bool dump_invisible = false; while (argc > 0) { diff --git a/tc/tc_stab.c b/tc/tc_stab.c index c0f1f160..45a6b184 100644 --- a/tc/tc_stab.c +++ b/tc/tc_stab.c @@ -51,7 +51,7 @@ int parse_size_table(int *argcp, char ***argvp, struct tc_sizespec *sp) { char **argv = *argvp; int argc = *argcp; - struct tc_sizespec s = {}; + struct tc_sizespec s = {0}; NEXT_ARG(); if (matches(*argv, "help") == 0) { diff --git a/tc/tc_util.c b/tc/tc_util.c index 0e70632d..8c083be2 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -129,7 +129,7 @@ ok: int print_tc_classid(char *buf, int blen, __u32 h) { - SPRINT_BUF(handle) = {}; + SPRINT_BUF(handle) = {0}; int hlen = SPRINT_BSIZE - 1; if (h == TC_H_ROOT) @@ -144,7 +144,7 @@ int print_tc_classid(char *buf, int blen, __u32 h) snprintf(handle, hlen, "%x:%x", TC_H_MAJ(h) >> 16, TC_H_MIN(h)); if (use_names) { - char clname[IDNAME_MAX] = {}; + char clname[IDNAME_MAX] = {0}; if (id_to_name(cls_names, h, clname)) snprintf(buf, blen, "%s#%s", clname, handle); @@ -895,7 +895,7 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, } /* backward compatibility */ if (tb[TCA_STATS]) { - struct tc_stats st = {}; + struct tc_stats st = {0}; /* handle case where kernel returns more/less than we know about */ memcpy(&st, RTA_DATA(tb[TCA_STATS]), diff --git a/tipc/bearer.c b/tipc/bearer.c index 4470819e..0bc8ed9e 100644 --- a/tipc/bearer.c +++ b/tipc/bearer.c @@ -84,8 +84,8 @@ static void cmd_bearer_enable_udp_help(struct cmdl *cmdl, char *media) static int get_netid_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {0}; int *netid = (int*)data; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); @@ -742,7 +742,7 @@ static int bearer_dump_udp_cb(const struct nlmsghdr *nlh, void *data) { struct sockaddr_storage *addr; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_UDP_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_UDP_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); @@ -778,9 +778,9 @@ static int bearer_get_udp_cb(const struct nlmsghdr *nlh, void *data) struct cb_data *cb_data = (struct cb_data *) data; struct sockaddr_storage *addr; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {}; - struct nlattr *opts[TIPC_NLA_UDP_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {0}; + struct nlattr *opts[TIPC_NLA_UDP_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_BEARER]) @@ -850,9 +850,9 @@ static int bearer_get_cb(const struct nlmsghdr *nlh, void *data) { int *prop = data; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {}; - struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {0}; + struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_BEARER]) @@ -1033,8 +1033,8 @@ static int cmd_bearer_get(struct nlmsghdr *nlh, const struct cmd *cmd, static int bearer_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_BEARER]) { diff --git a/tipc/link.c b/tipc/link.c index e123c186..196a4fe4 100644 --- a/tipc/link.c +++ b/tipc/link.c @@ -35,8 +35,8 @@ static const char tipc_bclink_name[] = "broadcast-link"; static int link_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_LINK]) @@ -86,9 +86,9 @@ static int link_get_cb(const struct nlmsghdr *nlh, void *data) { int *prop = data; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {}; - struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {0}; + struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_LINK]) @@ -508,10 +508,10 @@ static int link_stat_show_cb(const struct nlmsghdr *nlh, void *data) const char *name; const char *link = data; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {}; - struct nlattr *prop[TIPC_NLA_PROP_MAX + 1] = {}; - struct nlattr *stats[TIPC_NLA_STATS_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1] = {0}; + struct nlattr *prop[TIPC_NLA_PROP_MAX + 1] = {0}; + struct nlattr *stats[TIPC_NLA_STATS_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_LINK]) @@ -805,8 +805,8 @@ static int cmd_link_mon_set_prop(struct nlmsghdr *nlh, const struct cmd *cmd, static int link_mon_summary_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_MON]) @@ -938,8 +938,8 @@ static void link_mon_print_peer_state(const uint32_t addr, const char *status, static int link_mon_peer_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *attrs[TIPC_NLA_MON_PEER_MAX + 1] = {}; - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; + struct nlattr *attrs[TIPC_NLA_MON_PEER_MAX + 1] = {0}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; uint16_t member_cnt; uint32_t applied; uint32_t dom_gen; @@ -1016,8 +1016,8 @@ static int link_mon_peer_list(uint32_t mon_ref) static int link_mon_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {0}; char *req_bearer = data; const char *bname; const char title[] = @@ -1145,8 +1145,8 @@ static void cmd_link_mon_get_help(struct cmdl *cmdl) static int link_mon_get_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_MON_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_MON]) diff --git a/tipc/media.c b/tipc/media.c index 969ef657..4f60c2bc 100644 --- a/tipc/media.c +++ b/tipc/media.c @@ -26,8 +26,8 @@ static int media_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_MEDIA]) @@ -64,9 +64,9 @@ static int media_get_cb(const struct nlmsghdr *nlh, void *data) { int *prop = data; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1] = {}; - struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1] = {0}; + struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_MEDIA]) diff --git a/tipc/misc.c b/tipc/misc.c index 1daf3072..615c8a4c 100644 --- a/tipc/misc.c +++ b/tipc/misc.c @@ -154,7 +154,7 @@ void nodeid2str(uint8_t *id, char *str) void hash2nodestr(uint32_t hash, char *str) { - struct tipc_sioc_nodeid_req nr = {}; + struct tipc_sioc_nodeid_req nr = {0}; int sd; sd = socket(AF_TIPC, SOCK_RDM, 0); diff --git a/tipc/msg.c b/tipc/msg.c index dc09d050..b2416bb2 100644 --- a/tipc/msg.c +++ b/tipc/msg.c @@ -32,7 +32,7 @@ int parse_attrs(const struct nlattr *attr, void *data) static int family_id_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *tb[CTRL_ATTR_MAX + 1] = {}; + struct nlattr *tb[CTRL_ATTR_MAX + 1] = {0}; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); int *id = data; diff --git a/tipc/nametable.c b/tipc/nametable.c index d899eeb6..dd8a7a49 100644 --- a/tipc/nametable.c +++ b/tipc/nametable.c @@ -29,9 +29,9 @@ static int nametable_show_cb(const struct nlmsghdr *nlh, void *data) { int *iteration = data; struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_NAME_TABLE_MAX + 1] = {}; - struct nlattr *publ[TIPC_NLA_PUBL_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_NAME_TABLE_MAX + 1] = {0}; + struct nlattr *publ[TIPC_NLA_PUBL_MAX + 1] = {0}; const char *scope[] = { "", "zone", "cluster", "node" }; char str[33] = {0,}; diff --git a/tipc/node.c b/tipc/node.c index ffdaeaea..40eda09e 100644 --- a/tipc/node.c +++ b/tipc/node.c @@ -26,9 +26,9 @@ static int node_list_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_NODE_MAX + 1] = {}; - char str[33] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_NODE_MAX + 1] = {0}; + char str[33] = {0}; uint32_t addr; mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info); @@ -266,8 +266,8 @@ static int cmd_node_flush_key(struct nlmsghdr *nlh, const struct cmd *cmd, static int nodeid_get_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {0}; char str[33] = {0,}; uint8_t id[16] = {0,}; uint64_t *w0 = (uint64_t *) &id[0]; @@ -312,8 +312,8 @@ static int cmd_node_get_nodeid(struct nlmsghdr *nlh, const struct cmd *cmd, static int netid_get_cb(const struct nlmsghdr *nlh, void *data) { - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info); if (!info[TIPC_NLA_NET]) diff --git a/tipc/socket.c b/tipc/socket.c index 852984ec..c6bf518b 100644 --- a/tipc/socket.c +++ b/tipc/socket.c @@ -26,8 +26,8 @@ static int publ_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_PUBL]) @@ -64,8 +64,8 @@ static int publ_list(uint32_t sock) static int sock_list_cb(const struct nlmsghdr *nlh, void *data) { struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh); - struct nlattr *info[TIPC_NLA_MAX + 1] = {}; - struct nlattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {}; + struct nlattr *info[TIPC_NLA_MAX + 1] = {0}; + struct nlattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {0}; mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info); if (!info[TIPC_NLA_SOCK]) @@ -79,7 +79,7 @@ static int sock_list_cb(const struct nlmsghdr *nlh, void *data) if (attrs[TIPC_NLA_SOCK_CON]) { uint32_t node; - struct nlattr *con[TIPC_NLA_CON_MAX + 1] = {}; + struct nlattr *con[TIPC_NLA_CON_MAX + 1] = {0}; mnl_attr_parse_nested(attrs[TIPC_NLA_SOCK_CON], parse_attrs, con); node = mnl_attr_get_u32(con[TIPC_NLA_CON_NODE]); -- 2.25.0