Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sa clang 19 #17089

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,7 @@ const char *print_peer_gr_cmd(enum peer_gr_command pr_gr_cmd)

const char *print_global_gr_mode(enum global_mode gl_mode)
{
const char *global_gr_mode = "???";
const char *global_gr_mode;

switch (gl_mode) {
case GLOBAL_HELPER:
Expand Down
2 changes: 1 addition & 1 deletion bgpd/rfapi/bgp_rfapi_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -4401,7 +4401,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)

if (hc->redist_mode) /* ! default */
{
const char *s = "";
const char *s;

switch (hc->redist_mode) {
case VNC_REDIST_MODE_PLAIN:
Expand Down
3 changes: 2 additions & 1 deletion bgpd/rfapi/rfapi_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,8 @@ static int rfapiShowRemoteRegistrationsIt(struct bgp *bgp, void *stream,
if (!printed_rtlist_hdr) {
const char *agetype = "";
char *s;
const char *type = "";
const char *type;

if (show_imported) {
type = "Imported";
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/netns_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static int ns_enable_internal(struct ns *ns, void (*func)(ns_id_t, void *))
if (have_netns()) {
ns->fd = open(ns->name, O_RDONLY);
} else {
ns->fd = -2;
ns->fd = -1;
/* Remember ns_enable_hook has been called */
errno = -ENOTSUP;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/zclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ enum zebra_error_types {

static inline const char *zebra_error_type2str(enum zebra_error_types type)
{
const char *ret = "UNKNOWN";
const char *ret;

switch (type) {
case ZEBRA_UNKNOWN_ERROR:
Expand Down Expand Up @@ -780,7 +780,7 @@ enum zclient_send_status {
static inline const char *
zapi_nhg_notify_owner2str(enum zapi_nhg_notify_owner note)
{
const char *ret = "UNKNOWN";
const char *ret;

switch (note) {
case ZAPI_NHG_FAIL_INSTALL:
Expand All @@ -803,7 +803,7 @@ zapi_nhg_notify_owner2str(enum zapi_nhg_notify_owner note)
static inline const char *
zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note)
{
const char *ret = "UNKNOWN";
const char *ret;

switch (note) {
case ZAPI_RULE_FAIL_INSTALL:
Expand All @@ -825,7 +825,7 @@ zapi_rule_notify_owner2str(enum zapi_rule_notify_owner note)

static inline const char *zapi_srv6_sid_notify2str(enum zapi_srv6_sid_notify note)
{
const char *ret = "UNKNOWN";
const char *ret;

switch (note) {
case ZAPI_SRV6_SID_FAIL_ALLOC:
Expand Down
2 changes: 1 addition & 1 deletion lib/zlog_5424_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ static int log_5424_config_write(struct vty *vty)
struct zlog_cfg_5424_user *cfg;

frr_each (targets, &targets, cfg) {
const char *fmt_str = "";
const char *fmt_str;

vty_out(vty, "log extended %s\n", cfg->name);

Expand Down
3 changes: 2 additions & 1 deletion mgmtd/mgmt_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static bool mgmt_history_dump_cmt_record_index(void)
FILE *fp;
int ret = 0;
struct mgmt_cmt_info_t *cmt_info;
struct mgmt_cmt_info_t cmt_info_set[10];
struct mgmt_cmt_info_t cmt_info_set[MGMTD_MAX_COMMIT_LIST];
int cnt = 0;

snprintf(index_path, sizeof(index_path), MGMTD_COMMIT_INDEX_FILE_PATH);
Expand All @@ -166,6 +166,7 @@ static bool mgmt_history_dump_cmt_record_index(void)
return false;
}

assert(mgmt_cmt_infos_count(&mm->cmts) <= MGMTD_MAX_COMMIT_LIST);
FOREACH_CMT_REC (mm, cmt_info) {
memcpy(&cmt_info_set[cnt], cmt_info,
sizeof(struct mgmt_cmt_info_t));
Expand Down
7 changes: 6 additions & 1 deletion pimd/pim_bsr_rpdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,12 @@ int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
remain -= PIM_MSG_HEADER_LEN;

crp_hdr = (struct cand_rp_msg *)buf;
buf += sizeof(*crp_hdr);
/*
* buf += sizeof(*crp_hdr);
* Buff is not used for the remainder of the function
* but if it is we need to uncomment out the above set of the
* ptr for buf
*/
remain -= sizeof(*crp_hdr);

size_t ngroups = crp_hdr->prefix_cnt;
Expand Down
6 changes: 3 additions & 3 deletions vtysh/vtysh_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ int main(int argc, char **argv, char **env)
char pathspace[MAXPATHLEN] = "";
const char *histfile = NULL;
const char *histfile_env = getenv("VTYSH_HISTFILE");
const char *logpath;

/* SUID: drop down to calling user & go back up when needed */
elevuid = geteuid();
Expand Down Expand Up @@ -643,9 +644,8 @@ int main(int argc, char **argv, char **env)
}
}

if (getenv("VTYSH_LOG")) {
const char *logpath = getenv("VTYSH_LOG");

logpath = getenv("VTYSH_LOG");
if (logpath) {
logfile = fopen(logpath, "a");
if (!logfile) {
fprintf(stderr, "Failed to open logfile (%s): %s\n",
Expand Down
4 changes: 2 additions & 2 deletions zebra/zebra_dplane.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ enum dplane_op_e dplane_ctx_get_op(const struct zebra_dplane_ctx *ctx)

const char *dplane_op2str(enum dplane_op_e op)
{
const char *ret = "UNKNOWN";
const char *ret;

switch (op) {
case DPLANE_OP_NONE:
Expand Down Expand Up @@ -1226,7 +1226,7 @@ const char *dplane_op2str(enum dplane_op_e op)

const char *dplane_res2str(enum zebra_dplane_result res)
{
const char *ret = "<Unknown>";
const char *ret;

switch (res) {
case ZEBRA_DPLANE_REQUEST_FAILURE:
Expand Down
2 changes: 1 addition & 1 deletion zebra/zebra_nb_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_nexthop_bh_type_get_elem(
struct nb_cb_get_elem_args *args)
{
struct nexthop *nexthop = (struct nexthop *)args->list_entry;
const char *type_str = "";
const char *type_str;

if (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)
return NULL;
Expand Down
10 changes: 9 additions & 1 deletion zebra/zebra_netns_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,19 @@ void zebra_ns_notify_parse(void)
}
while ((dent = readdir(srcdir)) != NULL) {
struct stat st;
int dfd;

if (strcmp(dent->d_name, ".") == 0
|| strcmp(dent->d_name, "..") == 0)
continue;
if (fstatat(dirfd(srcdir), dent->d_name, &st, 0) < 0) {

dfd = dirfd(srcdir);
if (dfd == -1) {
flog_err_sys(EC_LIB_SYSTEM_CALL, "NS parsing directory: %s(%u)",
safe_strerror(errno), errno);
continue;
}
if (fstatat(dfd, dent->d_name, &st, 0) < 0) {
flog_err_sys(
EC_LIB_SYSTEM_CALL,
"NS parsing init: failed to parse entry %s",
Expand Down
Loading