mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:04:12 +08:00
mdbx: fix/model minor Coverity issues.
This commit is contained in:
parent
42d545e579
commit
99b75b5004
1
.github/actions/spelling/expect.txt
vendored
1
.github/actions/spelling/expect.txt
vendored
@ -1795,6 +1795,7 @@ underfilled
|
||||
UNDOC
|
||||
unicode
|
||||
UNIFORUM
|
||||
uninit
|
||||
uninstall
|
||||
UNINSTALLING
|
||||
uniq
|
||||
|
@ -13527,8 +13527,10 @@ int mdbx_get_ex(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, MDBX_val *data,
|
||||
MDBX_node *node = page_node(cx.outer.mc_pg[cx.outer.mc_top],
|
||||
cx.outer.mc_ki[cx.outer.mc_top]);
|
||||
if (F_ISSET(node_flags(node), F_DUPDATA)) {
|
||||
// coverity[uninit_use : FALSE]
|
||||
mdbx_tassert(txn, cx.outer.mc_xcursor == &cx.inner &&
|
||||
(cx.inner.mx_cursor.mc_flags & C_INITIALIZED));
|
||||
// coverity[uninit_use : FALSE]
|
||||
*values_count =
|
||||
(sizeof(*values_count) >= sizeof(cx.inner.mx_db.md_entries) ||
|
||||
cx.inner.mx_db.md_entries <= PTRDIFF_MAX)
|
||||
|
@ -1781,6 +1781,7 @@ retry_mapview:;
|
||||
|
||||
if (limit < map->limit) {
|
||||
/* unmap an excess at end of mapping. */
|
||||
// coverity[offset_free : FALSE]
|
||||
if (unlikely(munmap(map->dxb + limit, map->limit - limit)))
|
||||
return errno;
|
||||
map->limit = limit;
|
||||
@ -1854,6 +1855,7 @@ retry_mapview:;
|
||||
if (unlikely(munmap(map->address, map->limit)))
|
||||
return errno;
|
||||
|
||||
// coverity[pass_freed_arg : FALSE]
|
||||
ptr = mmap(map->address, limit, mmap_prot,
|
||||
(flags & MDBX_MRESIZE_MAY_MOVE)
|
||||
? mmap_flags
|
||||
@ -1863,11 +1865,13 @@ retry_mapview:;
|
||||
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
||||
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
||||
errno == /* kernel don't support MAP_FIXED_NOREPLACE */ EINVAL)
|
||||
// coverity[pass_freed_arg : FALSE]
|
||||
ptr = mmap(map->address, limit, mmap_prot, mmap_flags | MAP_FIXED,
|
||||
map->fd, 0);
|
||||
|
||||
if (unlikely(ptr == MAP_FAILED)) {
|
||||
/* try to restore prev mapping */
|
||||
// coverity[pass_freed_arg : FALSE]
|
||||
ptr = mmap(map->address, map->limit, mmap_prot,
|
||||
(flags & MDBX_MRESIZE_MAY_MOVE)
|
||||
? mmap_flags
|
||||
@ -1877,6 +1881,7 @@ retry_mapview:;
|
||||
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
||||
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
||||
errno == /* kernel don't support MAP_FIXED_NOREPLACE */ EINVAL)
|
||||
// coverity[pass_freed_arg : FALSE]
|
||||
ptr = mmap(map->address, map->limit, mmap_prot, mmap_flags | MAP_FIXED,
|
||||
map->fd, 0);
|
||||
if (unlikely(ptr == MAP_FAILED)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user