clang: Fix io-stats.c NULL pointer issue reported by clang
The issue pertains to checking if conf is NULL in BUMP_FOP but not providing that safety in io_stats_release when using conf to lock and bump nr_opens. This is now corrected to check if conf is non-NULL before attempting the lock and bump nr_opens. Tested with local clang analyzer to ensure this fixes the problem. Change-Id: Iffd6a97c2060d0a6930a8dc5914b1956c192cab1 Updates: bz#1622665 Signed-off-by: ShyamsundarR <srangana@redhat.com>
This commit is contained in:
parent
0566ecc878
commit
0b54c92a22
@ -3450,12 +3450,13 @@ io_stats_release(xlator_t *this, fd_t *fd)
|
||||
BUMP_FOP(RELEASE);
|
||||
|
||||
conf = this->private;
|
||||
|
||||
LOCK(&conf->lock);
|
||||
{
|
||||
conf->cumulative.nr_opens--;
|
||||
if (conf) {
|
||||
LOCK(&conf->lock);
|
||||
{
|
||||
conf->cumulative.nr_opens--;
|
||||
}
|
||||
UNLOCK(&conf->lock);
|
||||
}
|
||||
UNLOCK(&conf->lock);
|
||||
|
||||
ios_fd_ctx_get(fd, this, &iosfd);
|
||||
if (iosfd) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user