From 585b1fc113b92da19ee6967aee33b9f8ce2894ea Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Mon, 25 Oct 2021 15:28:31 +0900 Subject: [PATCH] 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 --- 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 5c28827930..c5f5018278 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 aacb6b8f3c..aac018ef50 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 */