some coverity fixes.
This commit is contained in:
parent
ddf1981004
commit
d526f1a0db
2 changed files with 8 additions and 3 deletions
|
@ -95,6 +95,8 @@ void utrace(struct ut *, int);
|
||||||
# define _MALLOC_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock);
|
# define _MALLOC_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock);
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
# define malloc_minsize 16U
|
# define malloc_minsize 16U
|
||||||
|
@ -1030,7 +1032,7 @@ free_pages(void *ptr, size_t idx, struct pginfo *info)
|
||||||
pf->size > malloc_cache && /* ..and the cache is full, */
|
pf->size > malloc_cache && /* ..and the cache is full, */
|
||||||
pf->end == malloc_brk && /* ..and none behind us, */
|
pf->end == malloc_brk && /* ..and none behind us, */
|
||||||
malloc_brk == sbrk((intptr_t)0)) { /* ..and it's OK to do... */
|
malloc_brk == sbrk((intptr_t)0)) { /* ..and it's OK to do... */
|
||||||
|
int r;
|
||||||
/*
|
/*
|
||||||
* Keep the cache intact. Notice that the '>' above guarantees that
|
* Keep the cache intact. Notice that the '>' above guarantees that
|
||||||
* the pf will always have at least one page afterwards.
|
* the pf will always have at least one page afterwards.
|
||||||
|
@ -1038,7 +1040,8 @@ free_pages(void *ptr, size_t idx, struct pginfo *info)
|
||||||
pf->end = (char *)pf->page + malloc_cache;
|
pf->end = (char *)pf->page + malloc_cache;
|
||||||
pf->size = malloc_cache;
|
pf->size = malloc_cache;
|
||||||
|
|
||||||
brk(pf->end);
|
r = brk(pf->end);
|
||||||
|
assert(r >= 0);
|
||||||
malloc_brk = pf->end;
|
malloc_brk = pf->end;
|
||||||
|
|
||||||
idx = ptr2idx(pf->end);
|
idx = ptr2idx(pf->end);
|
||||||
|
|
|
@ -677,6 +677,7 @@ static int map_subfree(struct vir_region *region,
|
||||||
if(start == 0 && len == region->length)
|
if(start == 0 && len == region->length)
|
||||||
full = 1;
|
full = 1;
|
||||||
|
|
||||||
|
physr_init_iter(&iter);
|
||||||
physr_start_iter(region->phys, &iter, start, AVL_GREATER_EQUAL);
|
physr_start_iter(region->phys, &iter, start, AVL_GREATER_EQUAL);
|
||||||
while((pr = physr_get_iter(&iter))) {
|
while((pr = physr_get_iter(&iter))) {
|
||||||
physr_incr_iter(&iter);
|
physr_incr_iter(&iter);
|
||||||
|
@ -981,7 +982,7 @@ int written;
|
||||||
if(!(newpb = pb_new(ml->phys)) ||
|
if(!(newpb = pb_new(ml->phys)) ||
|
||||||
!(newphysr = pb_reference(newpb, offset, region))) {
|
!(newphysr = pb_reference(newpb, offset, region))) {
|
||||||
printf("map_new_physblock: no memory for the ph slabs\n");
|
printf("map_new_physblock: no memory for the ph slabs\n");
|
||||||
if(newphysr) SLABFREE(newphysr);
|
assert(!newphysr);
|
||||||
if(newpb) SLABFREE(newpb);
|
if(newpb) SLABFREE(newpb);
|
||||||
r = ENOMEM;
|
r = ENOMEM;
|
||||||
break;
|
break;
|
||||||
|
@ -1715,6 +1716,7 @@ int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
|
||||||
* point to the same addresses, make them shrink by the
|
* point to the same addresses, make them shrink by the
|
||||||
* same amount.
|
* same amount.
|
||||||
*/
|
*/
|
||||||
|
physr_init_iter(&iter);
|
||||||
physr_start_iter(r->phys, &iter, offset, AVL_GREATER_EQUAL);
|
physr_start_iter(r->phys, &iter, offset, AVL_GREATER_EQUAL);
|
||||||
|
|
||||||
while((pr = physr_get_iter(&iter))) {
|
while((pr = physr_get_iter(&iter))) {
|
||||||
|
|
Loading…
Reference in a new issue