This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b00a47bc4cd1c9a21d29bd4108e180d948c2e984 Author: pangzhen1 <[email protected]> AuthorDate: Thu Oct 23 16:40:41 2025 +0800 sched/tls: cast values assigned to narrower uint16_t fields Fix Coverity: the value of an expression shall not be assigned to an object with a narrower essential type or a different essential type category (MISRA C-2012 Rule 10.3). fs_oflags and tl_size are uint16_t, so cast the int open flags and the ptrdiff_t stack size explicitly. Signed-off-by: pangzhen1 <[email protected]> --- sched/tls/task_initinfo.c | 2 +- sched/tls/tls_initinfo.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/tls/task_initinfo.c b/sched/tls/task_initinfo.c index 56d3ee3d52f..3155848b923 100644 --- a/sched/tls/task_initinfo.c +++ b/sched/tls/task_initinfo.c @@ -84,7 +84,7 @@ static void task_init_stream(FAR struct streamlist *list) */ stream[i].fs_cookie = (FAR char *)(intptr_t)i; - stream[i].fs_oflags = i ? O_WRONLY : O_RDONLY; + stream[i].fs_oflags = (uint16_t)(i ? O_WRONLY : O_RDONLY); } } #endif diff --git a/sched/tls/tls_initinfo.c b/sched/tls/tls_initinfo.c index c38704a19cf..0ba7c9c8d8c 100644 --- a/sched/tls/tls_initinfo.c +++ b/sched/tls/tls_initinfo.c @@ -67,8 +67,8 @@ int tls_init_info(FAR struct tcb_s *tcb) /* Derive tl_size w/o arch knowledge */ - info->tl_size = - (FAR char *)tcb->stack_base_ptr - (FAR char *)tcb->stack_alloc_ptr; + info->tl_size = (uint16_t)((FAR char *)tcb->stack_base_ptr - + (FAR char *)tcb->stack_alloc_ptr); /* Attach per-task info in group to TLS */
