1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: mask some warning about leakage

Mask false-positive leak report.
This commit is contained in:
Zdenek Kabelac 2021-09-19 20:21:55 +02:00
parent 548c69f581
commit 1b52451996
11 changed files with 16 additions and 1 deletions

View File

@ -245,6 +245,7 @@ static void daemonize(void)
}
LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON);
/* coverity[leaked_handle] devnull cannot leak here */
}
/*

View File

@ -1072,6 +1072,7 @@ out:
* "label at end of compound statement" */
;
/* coverity[lock_order] _global_mutex is kept locked */
pthread_cleanup_pop(1);
return NULL;

View File

@ -392,6 +392,7 @@ struct io_engine *create_async_io_engine(void)
e->page_mask = (unsigned) _pagesize - 1;
/* coverity[leaked_storage] 'e' is not leaking */
return &e->e;
}
@ -606,7 +607,8 @@ struct io_engine *create_sync_io_engine(void)
e->e.wait = _sync_wait;
e->e.max_io = _sync_max_io;
dm_list_init(&e->complete);
dm_list_init(&e->complete);
/* coverity[leaked_storage] 'e' is not leaking */
return &e->e;
}

View File

@ -408,6 +408,8 @@ static void _daemonise(daemon_state s)
}
setsid();
/* coverity[leaked_handle] 'fd' handle is not leaking */
}
response daemon_reply_simple(const char *id, ...)

View File

@ -664,6 +664,7 @@ static int _daemonise(struct filemap_monitor *fm)
if (fd > STDERR_FILENO)
(void) close(fd);
_early_log("Error redirecting stdin/out/err to null.");
/* coverity[leaked_handle] no leak */
return 0;
}
if (fd > STDERR_FILENO)

View File

@ -482,6 +482,7 @@ struct Source {
virtual void sync( Sink *sink ) {
ssize_t sz;
/* coverity[stack_use_local_overflow] */
char buf[ 128 * 1024 ];
if ( (sz = read(fd, buf, sizeof(buf) - 1)) > 0 )
sink->push( std::string( buf, sz ) );

View File

@ -67,6 +67,7 @@ static void *_fix_init(struct io_engine *engine)
T_ASSERT(f);
snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
/* coverity[secure_temp] don't care */
f->fd = mkstemp(f->fname);
T_ASSERT(f->fd >= 0);
@ -243,6 +244,7 @@ static void _reopen(struct fixture *f)
static uint8_t _random_pattern(void)
{
/* coverity[dont_call] don't care */
return random();
}

View File

@ -89,6 +89,7 @@ static void *_fix_init(void)
test_fail("posix_memalign failed");
snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
/* coverity[secure_temp] don't care */
f->fd = mkstemp(f->fname);
T_ASSERT(f->fd >= 0);

View File

@ -169,6 +169,7 @@ static void test_prefix_keys_reversed(void *fixture)
static void _gen_key(uint8_t *b, uint8_t *e)
{
for (; b != e; b++)
/* coverity[dont_call] don't care */
*b = rand() % 256;
}

View File

@ -200,6 +200,7 @@ static void _run_test(struct test_details *t, bool use_colour, unsigned *passed,
(*passed)++;
fprintf(stderr, "%s[ OK]%s\n", green(use_colour), normal(use_colour));
/* coverity[leaked_storage] fixture released by fixture_exit */
}
}

View File

@ -111,6 +111,8 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
_exit(ECMD_FAILED);
}
/* coverity[leaked_handle] null_fd does not leak here */
return 1;
}