fs/mqueue/mq_open.c: Add the judgment for mq_attr is NULL.

Signed-off-by: yangjiao <yangjiao@xiaomi.com>
This commit is contained in:
yangjiao
2023-06-13 22:02:47 +08:00
committed by Xiang Xiao
parent bef756c004
commit a543950951
+6 -3
View File
@@ -191,10 +191,13 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
mode = va_arg(ap, mode_t);
attr = va_arg(ap, FAR struct mq_attr *);
if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0)
if (attr != NULL)
{
ret = -EINVAL;
goto errout;
if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0)
{
ret = -EINVAL;
goto errout;
}
}
}