From: Martin Schwenke Date: Wed, 3 Jul 2019 10:58:54 +0000 (+1000) Subject: ctdb-tools: CID 1449530 - Negative loop bound X-Git-Tag: samba-4.11.0rc1~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=753874b38fddc05357635e13c8ce26d319b0d77f;p=thirdparty%2Fsamba.git ctdb-tools: CID 1449530 - Negative loop bound Regression introduced by commit 2558f96da1f9be8034f26736c8050bb38a1f82a8. count should be signed because list_of_connected_nodes() returns -1 on failure. Variable i is used in both signed and unsigned contexts, so add new signed variable j for use in signed context. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 9d46c981a0f..2cc72eedc76 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -3657,7 +3657,8 @@ static int control_reloadnodes(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, struct ctdb_req_control request; struct ctdb_reply_control **reply; bool reload; - unsigned int i, count; + unsigned int i; + int count; int ret; uint32_t *pnn_list; @@ -3726,13 +3727,14 @@ static int control_reloadnodes(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, &request, NULL, &reply); if (ret != 0) { bool failed = false; + int j; - for (i=0; i