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 1f6433174515aad583749abafcd33d4cd0d20418 Author: yangjianqing <[email protected]> AuthorDate: Tue May 12 11:31:26 2026 +0800 net/udp: initialize datalen to fix MISRA C-2012 Rule 9.1 violation Initialize local variable datalen to 0 at declaration to resolve Coverity CID 2623364 which flags the use of an uninitialized value. Although iob_copyout() writes to datalen before it is read, MISRA C-2012 Rule 9.1 requires all variables to be initialized before use. Signed-off-by: yangjianqing <[email protected]> --- net/udp/udp_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/udp/udp_ioctl.c b/net/udp/udp_ioctl.c index 28deed950b4..84349b5efec 100644 --- a/net/udp/udp_ioctl.c +++ b/net/udp/udp_ioctl.c @@ -173,7 +173,7 @@ int udp_ioctl(FAR struct udp_conn_s *conn, int cmd, unsigned long arg) iob = conn->readahead; if (iob) { - uint16_t datalen; + uint16_t datalen = 0; iob_copyout((FAR uint8_t *)&datalen, iob, sizeof(datalen), 0); *(FAR int *)((uintptr_t)arg) = datalen;
