From patchwork Thu Apr 18 10:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Ananyev X-Patchwork-Id: 139489 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA7E843E9F; Thu, 18 Apr 2024 12:33:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE420406A2; Thu, 18 Apr 2024 12:33:39 +0200 (CEST) Received: from forward500a.mail.yandex.net (forward500a.mail.yandex.net [178.154.239.80]) by mails.dpdk.org (Postfix) with ESMTP id B1A8940042 for ; Thu, 18 Apr 2024 12:33:38 +0200 (CEST) Received: from mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:7907:0:640:8f19:0]) by forward500a.mail.yandex.net (Yandex) with ESMTPS id 0979561609; Thu, 18 Apr 2024 13:33:38 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id GXCBSvCo7Ko0-fIfLNEJq; Thu, 18 Apr 2024 13:33:37 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1713436417; bh=8c3tm3/PJUM/SQrWnlTP1KUw5xveOMtjgo3R7mfldAo=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=Unx45vFdtLVx6qICjhYi5lwYSryGJPHBW/EYI5bxd8nGK37XEe0e5mDHEXbk2YbKp GDD2O7EMQtqUolZY9tVfkJzPrrldrkNtJLLRKj680CMu16GTk0byqNs4TnzMdmjpWJ DCTooPRKArsPtLXIy96AsAhZ94wS6uez28SDwq5A= Authentication-Results: mail-nwsmtp-smtp-production-main-22.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Konstantin Ananyev To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru, yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, vladimir.medvedkin@intel.com, honnappa.nagarahalli@arm.com, roretzla@linux.microsoft.com, Konstantin Ananyev Subject: [RFC 2/6] eal/common: remove VLA warnings Date: Thu, 18 Apr 2024 11:33:10 +0100 Message-Id: <20240418103314.40705-3-konstantin.v.ananyev@yandex.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240418103314.40705-1-konstantin.v.ananyev@yandex.ru> References: <20240418103314.40705-1-konstantin.v.ananyev@yandex.ru> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Konstantin Ananyev 1) ../lib/eal/common/eal_common_proc.c:695:15: warning: variable length array used [-Wvla] char control[CMSG_SPACE(fd_size)]; ^~~~~~~~~~~~~~~~~~~ As msg->num_fds should not exceed RTE_MP_MAX_FD_NUM, replaced it with fixed size array. Signed-off-by: Konstantin Ananyev Acked-by: Morten Brørup --- lib/eal/common/eal_common_proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index d24093937c..f21ce60a08 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -692,7 +692,8 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) struct sockaddr_un dst; struct mp_msg_internal m; int fd_size = msg->num_fds * sizeof(int); - char control[CMSG_SPACE(fd_size)]; + int32_t control_sz = CMSG_SPACE(fd_size); + char control[CMSG_SPACE(sizeof(msg->fds))]; m.type = type; memcpy(&m.msg, msg, sizeof(*msg)); @@ -712,7 +713,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type) msgh.msg_iov = &iov; msgh.msg_iovlen = 1; msgh.msg_control = control; - msgh.msg_controllen = sizeof(control); + msgh.msg_controllen = control_sz; cmsg = CMSG_FIRSTHDR(&msgh); cmsg->cmsg_len = CMSG_LEN(fd_size);