#1410 Dead code in ipa_subdomains_handler_done()
Closed: Fixed None Opened 8 years ago by sgallagh.

396static void ipa_subdomains_handler_done(struct tevent_req *req)
397{
398    int ret;
399    size_t reply_count;
400    struct sysdb_attrs **reply = NULL;
401    struct ipa_subdomains_req_ctx *ctx = tevent_req_callback_data(req,
402                                                       struct ipa_subdomains_req_ctx);
403    struct be_req *be_req = ctx->be_req;
404    struct sysdb_ctx *sysdb;
405
406    sysdb = (be_req->sysdb)?be_req->sysdb:be_req->be_ctx->sysdb;
407
408    ret = sdap_get_generic_recv(req, ctx, &reply_count, &reply);
409    talloc_zfree(req);
CID 12796: Logically dead code (DEADCODE)After this line (or expression), the value of "ret" cannot be 0.
410    if (ret != EOK) {
411        DEBUG(SSSDBG_OP_FAILURE, ("sdap_get_generic_send request failed.\n"));
412        goto done;
413    }
414
415    if (reply_count) {
416        ctx->reply = talloc_realloc(ctx, ctx->reply, struct sysdb_attrs *,
417                                    ctx->reply_count + reply_count);
418        if (ctx->reply == NULL) {
After this line, the value of "ret" is equal to 12.
Assigning: "ret" = "12".
419            ret = ENOMEM;
420            goto done;
421        }
422        memcpy(ctx->reply+ctx->reply_count, reply,
423               reply_count * sizeof(struct sysdb_attrs *));
424        ctx->reply_count += reply_count;
425    }
426
427    ctx->search_base_iter++;
428    ret = ipa_subdomains_handler_get(ctx, IPA_SUBDOMAINS_SLAVE);
429    if (ret == EAGAIN) {
430        return;
After this line (or expression), the value of "ret" cannot be any of { 0 11 }.
431    } else if (ret != EOK) {
432        goto done;
433    }
434
435    ret = ipa_subdomains_parse_results(ctx->sd_data, ctx->reply_count, ctx->reply);
After this line (or expression), the value of "ret" cannot be 0.
436    if (ret != EOK) {
437        DEBUG(SSSDBG_OP_FAILURE, ("ipa_subdomains_parse_results request failed.\n"));
438        goto done;
439    }
440
441    ret = sysdb_update_subdomains(sysdb, ctx->sd_data->domain_list);
After this line (or expression), the value of "ret" cannot be 0.
442    if (ret != EOK) {
443        DEBUG(SSSDBG_OP_FAILURE, ("sysdb_update_subdomains failed.\n"));
444        goto done;
445    }
446
447
448    ctx->search_base_iter = 0;
449    ctx->search_bases = ctx->sd_ctx->ranges_search_bases;
450    ret = ipa_subdomains_handler_get(ctx, IPA_SUBDOMAINS_RANGES);
451    if (ret == EAGAIN) {
452        return;
After this line (or expression), the value of "ret" cannot be any of { 0 11 }.
453    } else if (ret != EOK) {
454        goto done;
455    }
456
457    DEBUG(SSSDBG_OP_FAILURE, ("No search base for ranges available.\n"));
After this line, the value of "ret" is equal to 22.
Assigning: "ret" = "22".
458    ret = EINVAL;
459
460done:
461    talloc_free(ctx);
On this path, the condition "ret == 0" cannot be true.
Execution cannot reach this expression "0" inside statement "ipa_subdomains_reply(be_req...".
462    ipa_subdomains_reply(be_req, (ret == EOK ? DP_ERR_OK : DP_ERR_FATAL), ret);
463}

There's no way for this function to return EOK. (Though it can return to the mainloop if it gets EAGAIN in one place).


Fields changed

patch: 0 => 1
rhbz: => 0

Fixed by 8d04d44

milestone: NEEDS_TRIAGE => SSSD 1.9.0 beta 4
resolution: => fixed
status: new => closed

Sorry, previous comment was incorrect.

Fixed by a56156c

Metadata Update from @sgallagh:
- Issue assigned to sbose
- Issue set to the milestone: SSSD 1.9.0 beta 4

3 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2452

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata