* [PATCH 1/2] pcapng: fix fortified memcpy warning
@ 2024-05-21 1:01 Stephen Hemminger
2024-05-21 1:01 ` [PATCH 2/2] net/virtio: fix fortify " Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2024-05-21 1:01 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Reshma Pattan, Ray Kinsella
When adding option with no data, the rte_pcapng_add_option would
call memcpy with src of NULL and size of zero. This generates a
warning if fortify is enabled.
Bugzilla ID: 1446
Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/pcapng/rte_pcapng.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index f74ec939a9..7254defce7 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -128,7 +128,8 @@ pcapng_add_option(struct pcapng_option *popt, uint16_t code,
{
popt->code = code;
popt->length = len;
- memcpy(popt->data, data, len);
+ if (len > 0)
+ memcpy(popt->data, data, len);
return (struct pcapng_option *)((uint8_t *)popt + pcapng_optlen(len));
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] net/virtio: fix fortify memcpy warning
2024-05-21 1:01 [PATCH 1/2] pcapng: fix fortified memcpy warning Stephen Hemminger
@ 2024-05-21 1:01 ` Stephen Hemminger
2024-05-28 21:33 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2024-05-21 1:01 UTC (permalink / raw)
To: dev
Cc: Stephen Hemminger, Maxime Coquelin, Chenbo Xia, Neil Horman,
Yuanhan Liu, Huawei Xie, Jianfeng Tan
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 <stephen@networkplumber.org>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] net/virtio: fix fortify memcpy warning
2024-05-21 1:01 ` [PATCH 2/2] net/virtio: fix fortify " Stephen Hemminger
@ 2024-05-28 21:33 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2024-05-28 21:33 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Maxime Coquelin, Chenbo Xia, Huawei Xie, Jianfeng Tan
21/05/2024 03:01, Stephen Hemminger:
> 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")
Bugzilla ID: 1446
Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer")
Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Series applied quickly as it is blocking compilation on recent Ubuntu.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-28 21:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-21 1:01 [PATCH 1/2] pcapng: fix fortified memcpy warning Stephen Hemminger
2024-05-21 1:01 ` [PATCH 2/2] net/virtio: fix fortify " Stephen Hemminger
2024-05-28 21:33 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).