9
0
Fork 0

chdev_driver: Avoid NULL pointer dereference when bch->refs == 255. From Juha Niskanen

This commit is contained in:
Gregory Nutt 2015-03-12 07:58:36 -06:00
parent f6ff3be585
commit deaad84fc5
1 changed files with 1 additions and 1 deletions

View File

@ -307,7 +307,7 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct bchlib_s **bchr = (FAR struct bchlib_s **)((uintptr_t)arg);
bchlib_semtake(bch);
if (!bchr && bch->refs < 255)
if (!bchr || bch->refs == MAX_OPENCNT)
{
ret = -EINVAL;
}