From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7971A4407E; Tue, 21 May 2024 03:01:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9530E402D2; Tue, 21 May 2024 03:01:11 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id B37464021E for ; Tue, 21 May 2024 03:01:09 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e3c3aa8938so93339785ad.1 for ; Mon, 20 May 2024 18:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716253269; x=1716858069; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k2X9wWHRVJRUc2JTC45jlhNVud2ZSvUVKoUSUCg4mWk=; b=aM+NdeHVGeFgsfq7x7Z6OrjRjtzzsiGicUP2DXwotbqNFQpPEofohkLqKy+DJ0/Vbk dznaYlZg506YEaELzy+smXTXC75+djSQD5trtLynXbIWQGD6OCCksCVwXQl/9ge98Ixj RL4UgTVHXOQFwJY7eUiNcE74/4tPOuL7HLszwkZZmx7Djcryj+3tj3cflCtn0B8ggVdO +vAGjHKIMIhRH+VUsL3yfsXdCfwwrjY/laqKBYiv1oNnHjf0O5VPWtG9nfgKw2F3SSH9 L2JP4k8jOOaJjz6vJkaYAizcTHOwUabUizQ4qrrSUNGGwfI6jlNUK2plF3BQElcozeBJ NkCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716253269; x=1716858069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k2X9wWHRVJRUc2JTC45jlhNVud2ZSvUVKoUSUCg4mWk=; b=gePhMMFVU5kT1FQtraoTELEHS/ZK3V/p6l22ViCpny9pzhDTThl01mAbPWNjBHyUvt wqL//aMxVxjd9YtQWEtfbSe2+urUq2hPE1L/VkwBHYk/QRRUD/1xwdHfWXPRsHWUY7SX eH90yHrXRxFsgHC97VH/jMoMiPKY4+OjD36cwaXEPzMprqOhDz7qv2dVq+cupNIWfGlz 0tX/okLy89yBn39C/AdMaVyHwI/oRDh/ppC28dH8ieAKFcKhtgHRRXpb9G2vbFJDxvPQ NvX/bcIBmUycIx3V8ELVG6yyhLnBBqwChwP3xK/Vzs9cgoFnEaUPD83PiVNCJJ+Pzg3W 3eIg== X-Gm-Message-State: AOJu0YxR75b6lm52qbs3q8+1e6Iigz2qdpX64vmaaC155XOZlBfTv0n7 wDKc9/o81ASIXHAz7hpsXVGgihGAxGczVC+931gp5lB0BqWIPnqv3mlEMKP93zPzGacx/tGxICG 5+2E= X-Google-Smtp-Source: AGHT+IG8uaTpS7taJ08IR96Q7O/Fr0vuzPYNggKH8M1pbI+NDLLFbMuWNjPIqGhLYvIaYV4dgO1/BQ== X-Received: by 2002:a17:902:a513:b0:1ea:6fb2:5a88 with SMTP id d9443c01a7336-1ef4404cc69mr266791035ad.68.1716253268816; Mon, 20 May 2024 18:01:08 -0700 (PDT) Received: from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0bf32f51sm215179485ad.154.2024.05.20.18.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 18:01:08 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Maxime Coquelin , Chenbo Xia , Neil Horman , Yuanhan Liu , Huawei Xie , Jianfeng Tan Subject: [PATCH 2/2] net/virtio: fix fortify memcpy warning Date: Mon, 20 May 2024 18:01:04 -0700 Message-ID: <20240521010105.81868-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240521010105.81868-1-stephen@networkplumber.org> References: <20240521010105.81868-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 If fortify is enabled, it will generate a warning if memcpy src is NULL even if size is zero. This happens if the MP message sync is called with no file descriptors. Bugzilla ID 1446 Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer") Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_user/vhost_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c index 3c05ac9cc0..c10252506b 100644 --- a/drivers/net/virtio/virtio_user/vhost_user.c +++ b/drivers/net/virtio/virtio_user/vhost_user.c @@ -128,7 +128,8 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num) cmsg->cmsg_len = CMSG_LEN(fd_size); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - memcpy(CMSG_DATA(cmsg), fds, fd_size); + if (fd_size > 0) + memcpy(CMSG_DATA(cmsg), fds, fd_size); do { r = sendmsg(fd, &msgh, 0); -- 2.43.0