Shanks0224 opened a new pull request, #22293:
URL: https://github.com/apache/nuttx/pull/22293

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   ## Summary
   
   `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.
   
   ## Impact
   
   Only builds with `CONFIG_DEBUG_ASSERTIONS` change: an oversized
   `mq_msgsize` now fails with `EINVAL`, as it already did without
   assertions. No impact on the build system, documentation or hardware.
   
   ## Testing
   
   Build host: Linux x86_64.
   
   Regression test: apache/nuttx-apps#APPS_PR (ostest `mqueue_test` opens a
   queue with `mq_msgsize = CONFIG_MQ_MAXMSGSIZE + 1` and expects `EINVAL`).
   
   `sim:nsh` + `CONFIG_TESTING_OSTEST` + `CONFIG_DEBUG_ASSERTIONS`, ostest,
   before this PR:
   
   ```
   mqueue_test: Opening a queue with an oversized message size
   dump_assert_info: Current Version: NuttX  13.1.1-RC0 bbc5b51ac85 Nov 25 2026 
10:24:40 sim
   dump_assert_info: Assertion failed (!attr || attr->mq_msgsize <= 
MQ_MAX_BYTES) && pmsgq: at file: mqueue/mq_msgqalloc.c:76 task: ostest process: 
ostest 0x4008cb71
   ...
   ostest_main: Exiting with status 256
   ```
   
   With this PR:
   
   ```
   mqueue_test: Opening a queue with an oversized message size
   mqueue_test: Starting receiver
   ...
   ostest_main: Exiting with status 0
   ```
   
   `sim:nsh` builds with no warning. Not tested on real hardware.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to