From 4c30cecad26f615bddbeaf610d51a2076fd407bb Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 5 Sep 2011 01:21:55 +0000 Subject: [PATCH] Silence various "may be used uninitialized" warnings from GCC caused by it not figuring out the control flow (initialization and use both tied to some other variable). DB2 code not included. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25146 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/apputils/net-server.c | 2 +- src/lib/kadm5/str_conv.c | 2 +- src/lib/kdb/kdb_default.c | 1 + src/lib/krb5/krb/authdata.c | 2 +- src/lib/krb5/krb/send_tgs.c | 2 +- src/lib/krb5/os/sendto_kdc.c | 2 +- src/lib/rpc/svc_tcp.c | 4 ++-- src/lib/rpc/svc_udp.c | 4 ++-- src/plugins/preauth/pkinit/pkinit_srv.c | 2 +- src/tests/create/kdb5_mkdums.c | 2 +- src/tests/verify/kdb5_verify.c | 2 +- 11 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c index 542aa5c0e..9c0d5849d 100644 --- a/src/lib/apputils/net-server.c +++ b/src/lib/apputils/net-server.c @@ -1652,7 +1652,7 @@ process_packet(verto_ctx *ctx, verto_ev *ev) static int kill_lru_tcp_or_rpc_connection(void *handle, verto_ev *newev) { - struct connection *c, *oldest_c = NULL; + struct connection *c = NULL, *oldest_c = NULL; verto_ev *ev, *oldest_ev = NULL; int i, fd = -1; diff --git a/src/lib/kadm5/str_conv.c b/src/lib/kadm5/str_conv.c index b36af1e24..37a27dd36 100644 --- a/src/lib/kadm5/str_conv.c +++ b/src/lib/kadm5/str_conv.c @@ -261,7 +261,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) { krb5_error_code kret; char *kp, *sp, *ep; - char sepchar, trailchar; + char sepchar = 0, trailchar = 0; krb5_enctype ktype; krb5_int32 stype; krb5_key_salt_tuple *savep; diff --git a/src/lib/kdb/kdb_default.c b/src/lib/kdb/kdb_default.c index d8dd4266e..c4bf92e50 100644 --- a/src/lib/kdb/kdb_default.c +++ b/src/lib/kdb/kdb_default.c @@ -74,6 +74,7 @@ krb5_dbe_def_search_enctype(kcontext, dbentp, start, ktype, stype, kvno, kdatap) } maxkvno = -1; + idx = -1; datap = (krb5_key_data *) NULL; for (i = *start; i < dbentp->n_key_data; i++) { krb5_boolean similar; diff --git a/src/lib/krb5/krb/authdata.c b/src/lib/krb5/krb/authdata.c index a24143062..414e8bcac 100644 --- a/src/lib/krb5/krb/authdata.c +++ b/src/lib/krb5/krb/authdata.c @@ -71,7 +71,7 @@ k5_ad_init_modules(krb5_context kcontext, int j, k = *module_count; krb5_error_code code; void *plugin_context = NULL; - void **rcpp; + void **rcpp = NULL; if (table->ad_type_list == NULL) { #ifdef DEBUG diff --git a/src/lib/krb5/krb/send_tgs.c b/src/lib/krb5/krb/send_tgs.c index 1847aaa1d..4f616ab28 100644 --- a/src/lib/krb5/krb/send_tgs.c +++ b/src/lib/krb5/krb/send_tgs.c @@ -168,7 +168,7 @@ krb5int_make_tgs_request_ext(krb5_context context, { krb5_error_code retval; krb5_kdc_req tgsreq; - krb5_data *scratch, scratch2; + krb5_data *scratch, scratch2 = empty_data(); krb5_ticket *sec_ticket = NULL; krb5_ticket *sec_ticket_arr[2]; krb5_timestamp time_now; diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c index 2856c09a7..63dbcd8f4 100644 --- a/src/lib/krb5/os/sendto_kdc.c +++ b/src/lib/krb5/os/sendto_kdc.c @@ -1146,7 +1146,7 @@ service_fds(krb5_context context, struct select_state *selstate, int interval, int (*msg_handler)(krb5_context, const krb5_data *, void *), void *msg_handler_data, struct conn_state **winner_out) { - int e, selret; + int e, selret = 0; struct timeval now; struct conn_state *state; diff --git a/src/lib/rpc/svc_tcp.c b/src/lib/rpc/svc_tcp.c index b64fbb713..581ab3c1a 100644 --- a/src/lib/rpc/svc_tcp.c +++ b/src/lib/rpc/svc_tcp.c @@ -492,8 +492,8 @@ static bool_t svctcp_reply( register XDR *xdrs = &(cd->xdrs); register bool_t stat; - xdrproc_t xdr_results; - caddr_t xdr_location; + xdrproc_t xdr_results = NULL; + caddr_t xdr_location = 0; bool_t has_args; if (msg->rm_reply.rp_stat == MSG_ACCEPTED && diff --git a/src/lib/rpc/svc_udp.c b/src/lib/rpc/svc_udp.c index e605b1a8f..7c37aeb0e 100644 --- a/src/lib/rpc/svc_udp.c +++ b/src/lib/rpc/svc_udp.c @@ -242,8 +242,8 @@ static bool_t svcudp_reply( register int slen; register bool_t stat = FALSE; - xdrproc_t xdr_results; - caddr_t xdr_location; + xdrproc_t xdr_results = NULL; + caddr_t xdr_location = 0; bool_t has_args; if (msg->rm_reply.rp_stat == MSG_ACCEPTED && diff --git a/src/plugins/preauth/pkinit/pkinit_srv.c b/src/plugins/preauth/pkinit/pkinit_srv.c index 3cd976d1e..1dea777e7 100644 --- a/src/plugins/preauth/pkinit/pkinit_srv.c +++ b/src/plugins/preauth/pkinit/pkinit_srv.c @@ -306,7 +306,7 @@ pkinit_server_verify_padata(krb5_context context, krb5_auth_pack *auth_pack = NULL; krb5_auth_pack_draft9 *auth_pack9 = NULL; pkinit_kdc_context plgctx = NULL; - pkinit_kdc_req_context reqctx; + pkinit_kdc_req_context reqctx = NULL; krb5_preauthtype pa_type; krb5_checksum cksum = {0, 0, 0, NULL}; krb5_data *der_req = NULL; diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index bc2fe5992..5a042a91f 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -97,7 +97,7 @@ main(argc, argv) int num_to_create; char principal_string[BUFSIZ]; char *suffix = 0; - size_t suffix_size; + size_t suffix_size = 0; int depth; krb5_init_context(&test_context); diff --git a/src/tests/verify/kdb5_verify.c b/src/tests/verify/kdb5_verify.c index 429419975..b82a86aec 100644 --- a/src/tests/verify/kdb5_verify.c +++ b/src/tests/verify/kdb5_verify.c @@ -93,7 +93,7 @@ main(argc, argv) int num_to_check; char principal_string[BUFSIZ]; char *suffix = 0; - size_t suffix_size; + size_t suffix_size = 0; int depth, errors; krb5_init_context(&context); -- 2.26.2