#1900 Uninitialized scalar variable in idmap.c
Closed: Fixed None Opened 7 years ago by jhrozek.

Reported by Coverity:

1. var_decl: Declaring variable "new_slice" without initializer.
242    id_t new_slice;
243    id_t min;
244    id_t max;
245    id_t idmap_lower;
246    id_t idmap_upper;
247    id_t rangesize;
248    bool autorid_mode;
249    uint32_t hash_val;
250    struct idmap_domain_info *dom;
251

2. Condition "ctx == NULL", taking false branch

3. Condition "ctx->alloc_func == NULL", taking false branch

4. Condition "ctx->free_func == NULL", taking false branch
252    CHECK_IDMAP_CTX(ctx, IDMAP_CONTEXT_INVALID);
253
254    idmap_lower = ctx->idmap_opts.idmap_lower;
255    idmap_upper = ctx->idmap_opts.idmap_upper;
256    rangesize = ctx->idmap_opts.rangesize;
257    autorid_mode = ctx->idmap_opts.autorid_mode;
258
259    max_slices = (idmap_upper - idmap_lower) / rangesize;
260

5. Condition "slice_num", taking true branch

6. Condition "*slice_num != -1", taking false branch
261    if (slice_num && *slice_num != -1) {
262        /* The slice is being set explicitly.
263         * This may happen at system startup when we're loading
264         * previously-determined slices. In the future, we may also
265         * permit configuration to select the slice for a domain
266         * explicitly.
267         */
268        new_slice = *slice_num;
269    } else {
270        /* If slice is -1, we're being asked to pick a new slice */
271

7. Condition "autorid_mode", taking true branch
272        if (autorid_mode) {
273            /* In autorid compatibility mode, always start at 0 and find the
274             * first free value.
275             */
276            orig_slice = 0;

8. Falling through to end of if statement
277        } else {
278            /* Hash the domain sid string */
279            hash_val = murmurhash3(dom_sid, strlen(dom_sid), 0xdeadbeef);
280
281            /* Now get take the modulus of the hash val and the max_slices
282             * to determine its optimal position in the range.
283             */
284            new_slice = hash_val % max_slices;
285            orig_slice = new_slice;
286        }
287

CID 11639 (#1 of 1): Uninitialized scalar variable (UNINIT)9. uninit_use: Using uninitialized value "new_slice".
288        min = (rangesize * new_slice) + idmap_lower;

owner: somebody => okos

Fields changed

resolution: => fixed
status: new => closed

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.10 beta

Fields changed

rhbz: => 0

Metadata Update from @jhrozek:
- Issue assigned to okos
- Issue set to the milestone: SSSD 1.10 beta

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/2942

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