mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:54:14 +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
|
UNDOC
|
||||||
unicode
|
unicode
|
||||||
UNIFORUM
|
UNIFORUM
|
||||||
|
uninit
|
||||||
uninstall
|
uninstall
|
||||||
UNINSTALLING
|
UNINSTALLING
|
||||||
uniq
|
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],
|
MDBX_node *node = page_node(cx.outer.mc_pg[cx.outer.mc_top],
|
||||||
cx.outer.mc_ki[cx.outer.mc_top]);
|
cx.outer.mc_ki[cx.outer.mc_top]);
|
||||||
if (F_ISSET(node_flags(node), F_DUPDATA)) {
|
if (F_ISSET(node_flags(node), F_DUPDATA)) {
|
||||||
|
// coverity[uninit_use : FALSE]
|
||||||
mdbx_tassert(txn, cx.outer.mc_xcursor == &cx.inner &&
|
mdbx_tassert(txn, cx.outer.mc_xcursor == &cx.inner &&
|
||||||
(cx.inner.mx_cursor.mc_flags & C_INITIALIZED));
|
(cx.inner.mx_cursor.mc_flags & C_INITIALIZED));
|
||||||
|
// coverity[uninit_use : FALSE]
|
||||||
*values_count =
|
*values_count =
|
||||||
(sizeof(*values_count) >= sizeof(cx.inner.mx_db.md_entries) ||
|
(sizeof(*values_count) >= sizeof(cx.inner.mx_db.md_entries) ||
|
||||||
cx.inner.mx_db.md_entries <= PTRDIFF_MAX)
|
cx.inner.mx_db.md_entries <= PTRDIFF_MAX)
|
||||||
|
@ -1781,6 +1781,7 @@ retry_mapview:;
|
|||||||
|
|
||||||
if (limit < map->limit) {
|
if (limit < map->limit) {
|
||||||
/* unmap an excess at end of mapping. */
|
/* unmap an excess at end of mapping. */
|
||||||
|
// coverity[offset_free : FALSE]
|
||||||
if (unlikely(munmap(map->dxb + limit, map->limit - limit)))
|
if (unlikely(munmap(map->dxb + limit, map->limit - limit)))
|
||||||
return errno;
|
return errno;
|
||||||
map->limit = limit;
|
map->limit = limit;
|
||||||
@ -1854,6 +1855,7 @@ retry_mapview:;
|
|||||||
if (unlikely(munmap(map->address, map->limit)))
|
if (unlikely(munmap(map->address, map->limit)))
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
|
// coverity[pass_freed_arg : FALSE]
|
||||||
ptr = mmap(map->address, limit, mmap_prot,
|
ptr = mmap(map->address, limit, mmap_prot,
|
||||||
(flags & MDBX_MRESIZE_MAY_MOVE)
|
(flags & MDBX_MRESIZE_MAY_MOVE)
|
||||||
? mmap_flags
|
? mmap_flags
|
||||||
@ -1863,11 +1865,13 @@ retry_mapview:;
|
|||||||
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
||||||
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
||||||
errno == /* kernel don't support MAP_FIXED_NOREPLACE */ EINVAL)
|
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,
|
ptr = mmap(map->address, limit, mmap_prot, mmap_flags | MAP_FIXED,
|
||||||
map->fd, 0);
|
map->fd, 0);
|
||||||
|
|
||||||
if (unlikely(ptr == MAP_FAILED)) {
|
if (unlikely(ptr == MAP_FAILED)) {
|
||||||
/* try to restore prev mapping */
|
/* try to restore prev mapping */
|
||||||
|
// coverity[pass_freed_arg : FALSE]
|
||||||
ptr = mmap(map->address, map->limit, mmap_prot,
|
ptr = mmap(map->address, map->limit, mmap_prot,
|
||||||
(flags & MDBX_MRESIZE_MAY_MOVE)
|
(flags & MDBX_MRESIZE_MAY_MOVE)
|
||||||
? mmap_flags
|
? mmap_flags
|
||||||
@ -1877,6 +1881,7 @@ retry_mapview:;
|
|||||||
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
if (MAP_FIXED_NOREPLACE != 0 && MAP_FIXED_NOREPLACE != MAP_FIXED &&
|
||||||
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
unlikely(ptr == MAP_FAILED) && !(flags & MDBX_MRESIZE_MAY_MOVE) &&
|
||||||
errno == /* kernel don't support MAP_FIXED_NOREPLACE */ EINVAL)
|
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,
|
ptr = mmap(map->address, map->limit, mmap_prot, mmap_flags | MAP_FIXED,
|
||||||
map->fd, 0);
|
map->fd, 0);
|
||||||
if (unlikely(ptr == MAP_FAILED)) {
|
if (unlikely(ptr == MAP_FAILED)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user