This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 61647f15d4e sched/mqueue: Do not assert on an oversized mq_msgsize.
61647f15d4e is described below

commit 61647f15d4ed0fb5315434227f83faa6db46eb85
Author: fangxinyong <[email protected]>
AuthorDate: Wed Nov 25 10:23:52 2026 +0800

    sched/mqueue: Do not assert on an oversized mq_msgsize.
    
    mq_open() passes the attributes of the application to nxmq_alloc_msgq(),
    which asserted that mq_msgsize does not exceed CONFIG_MQ_MAXMSGSIZE
    right before it checks that and returns -EINVAL.  With
    CONFIG_DEBUG_ASSERTIONS a bad argument of an application stopped the
    system instead of failing mq_open() with EINVAL.  Keep the assertion
    only for the pointer, which comes from the kernel.
    
    Signed-off-by: fangxinyong <[email protected]>
    Signed-off-by: ganjing <[email protected]>
---
 sched/mqueue/mq_msgqalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sched/mqueue/mq_msgqalloc.c b/sched/mqueue/mq_msgqalloc.c
index a74707fe4c8..f86104ddcdf 100644
--- a/sched/mqueue/mq_msgqalloc.c
+++ b/sched/mqueue/mq_msgqalloc.c
@@ -73,7 +73,7 @@ int nxmq_alloc_msgq(FAR struct mq_attr *attr,
    * larger than the configured maximum message size.
    */
 
-  DEBUGASSERT((!attr || attr->mq_msgsize <= MQ_MAX_BYTES) && pmsgq);
+  DEBUGASSERT(pmsgq != NULL);
   if ((attr && attr->mq_msgsize > MQ_MAX_BYTES) || !pmsgq)
     {
       return -EINVAL;

Reply via email to