diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2010-07-08 10:11:02 -0700 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-07-23 13:39:56 -0700 |
| commit | 2d69093cf71107b36a58b7d7359abc9ca93071f1 (patch) | |
| tree | 654bf2089621d9297ba0ea343e8f8e7cc0b39edd | |
| parent | f66b608d3880b251a35c32c0d6eeb2a6c23dea2b (diff) | |
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11829 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_start() ds/ldap/servers/slapd/back-ldbm/start.c
Comment:
The code meant the autosized cache should be reduced 25%
if the calculated size was less than 500MB for the overhead
of libdb. If larger than 500MB, the overhead is relatively
small and can be ignored. The code should have calculated
the size before comparing it to 500MB.
| -rw-r--r-- | ldap/servers/slapd/back-ldbm/start.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c index 06bf7deb..8ea44aa1 100644 --- a/ldap/servers/slapd/back-ldbm/start.c +++ b/ldap/servers/slapd/back-ldbm/start.c @@ -91,12 +91,11 @@ ldbm_back_start( Slapi_PBlock *pb ) /* sanity check the autosizing values, no value or sum of values larger than 100. */ - if ( (li->li_cache_autosize > 100) || - (li->li_cache_autosize_split > 100) || - (li->li_import_cache_autosize > 100) || - ((li->li_cache_autosize > 0) && (li->li_import_cache_autosize > 0) && - (li->li_cache_autosize + li->li_import_cache_autosize > 100)) ) - { + if ((li->li_cache_autosize > 100) || + (li->li_cache_autosize_split > 100) || + (li->li_import_cache_autosize > 100) || + ((li->li_cache_autosize > 0) && (li->li_import_cache_autosize > 0) && + (li->li_cache_autosize + li->li_import_cache_autosize > 100))) { LDAPDebug( LDAP_DEBUG_ANY, "cache autosizing: bad settings, " "value or sum of values can not larger than 100.\n", 0, 0, 0 ); } else @@ -126,11 +125,12 @@ ldbm_back_start( Slapi_PBlock *pb ) db_pages*(pagesize/1024), objset_size(li->li_instance_set), entry_pages*(pagesize/1024)); - /* libdb allocates 1.25x the amount we tell it to, but only for values < 500Meg */ + /* libdb allocates 1.25x the amount we tell it to, + * but only for values < 500Meg + * For the larger memory, the overhead is relatively small. */ + cache_size_to_configure = (unsigned long)(db_pages * pagesize); if (cache_size_to_configure < (500 * MEGABYTE)) { cache_size_to_configure = (unsigned long)((db_pages * pagesize) / 1.25); - } else { - cache_size_to_configure = (unsigned long)(db_pages * pagesize); } sprintf(s, "%lu", cache_size_to_configure); ldbm_config_internal_set(li, CONFIG_DBCACHESIZE, s); |
