You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/10/25 08:57:18 UTC

[incubator-nuttx] branch master updated: fs: mqueue: Change MAX_MQUEUE_PATH to 64

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 585b1fc  fs: mqueue: Change MAX_MQUEUE_PATH to 64
585b1fc is described below

commit 585b1fc113b92da19ee6967aee33b9f8ce2894ea
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Oct 25 15:28:31 2021 +0900

    fs: mqueue: Change MAX_MQUEUE_PATH to 64
    
    Summary:
    - This commit changes MAX_MQUEUE_PATH to 64 to reduce stack
      memory if the NAME_MAX is large
    
    Impact:
    - None
    
    Testing:
    - Tested with spresense:rndis_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 fs/mqueue/mq_open.c | 3 ++-
 fs/mqueue/mqueue.h  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 5c28827..c5f5018 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -177,7 +177,8 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
       goto errout;
     }
 
-  if (strlen(mq_name) > NAME_MAX)
+  if (sizeof(CONFIG_FS_MQUEUE_MPATH) + 1 + strlen(mq_name)
+      >= MAX_MQUEUE_PATH)
     {
       ret = -ENAMETOOLONG;
       goto errout;
diff --git a/fs/mqueue/mqueue.h b/fs/mqueue/mqueue.h
index aacb6b8..aac018e 100644
--- a/fs/mqueue/mqueue.h
+++ b/fs/mqueue/mqueue.h
@@ -39,6 +39,6 @@
 
 /* Sizes of things */
 
-#define MAX_MQUEUE_PATH (sizeof(CONFIG_FS_MQUEUE_MPATH) + NAME_MAX)
+#define MAX_MQUEUE_PATH 64
 
 #endif /* __FS_MQUEUE_MQUEUE_H */