* [PATCH] vhost/crypto: fix descriptor processing
@ 2022-06-22 15:30 David Marchand
2022-06-22 15:34 ` Maxime Coquelin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Marchand @ 2022-06-22 15:30 UTC (permalink / raw)
To: dev; +Cc: roy.fan.zhang, Jakub Poczatek, Maxime Coquelin, Chenbo Xia
copy_data was returning a pointer to an increased (off by one) descriptor.
Subsequent calls to copy_data in the library were then failing.
Fix this by incrementing the descriptor only if there is some left data
to copy.
Fixes: 7287660a21e0 ("vhost/crypto: fix build with GCC 12")
Reported-by: Jakub Poczatek <jakub.poczatek@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/vhost/vhost_crypto.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 96ffb82a5d..54946f46d9 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req *vc_req,
return -1;
left -= copied;
data = RTE_PTR_ADD(data, copied);
- desc++;
- } while (desc < head + max_n_descs && left != 0);
+ } while (left != 0 && ++desc < head + max_n_descs);
if (unlikely(left != 0))
return -1;
--
2.36.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost/crypto: fix descriptor processing
2022-06-22 15:30 [PATCH] vhost/crypto: fix descriptor processing David Marchand
@ 2022-06-22 15:34 ` Maxime Coquelin
2022-06-22 16:34 ` Zhang, Roy Fan
2022-06-22 17:14 ` Maxime Coquelin
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2022-06-22 15:34 UTC (permalink / raw)
To: David Marchand, dev; +Cc: roy.fan.zhang, Jakub Poczatek, Chenbo Xia
On 6/22/22 17:30, David Marchand wrote:
> copy_data was returning a pointer to an increased (off by one) descriptor.
> Subsequent calls to copy_data in the library were then failing.
> Fix this by incrementing the descriptor only if there is some left data
> to copy.
>
> Fixes: 7287660a21e0 ("vhost/crypto: fix build with GCC 12")
>
> Reported-by: Jakub Poczatek <jakub.poczatek@intel.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
And also, from discussions on the faulty commit thread, we can add:
Tested-by: Jakub Poczatek <jakub.poczatek@intel.com>
Thanks Jakub for the quick testing,
Maxime
> ---
> lib/vhost/vhost_crypto.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index 96ffb82a5d..54946f46d9 100644
> --- a/lib/vhost/vhost_crypto.c
> +++ b/lib/vhost/vhost_crypto.c
> @@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req *vc_req,
> return -1;
> left -= copied;
> data = RTE_PTR_ADD(data, copied);
> - desc++;
> - } while (desc < head + max_n_descs && left != 0);
> + } while (left != 0 && ++desc < head + max_n_descs);
>
> if (unlikely(left != 0))
> return -1;
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] vhost/crypto: fix descriptor processing
2022-06-22 15:30 [PATCH] vhost/crypto: fix descriptor processing David Marchand
2022-06-22 15:34 ` Maxime Coquelin
@ 2022-06-22 16:34 ` Zhang, Roy Fan
2022-06-22 17:14 ` Maxime Coquelin
2 siblings, 0 replies; 4+ messages in thread
From: Zhang, Roy Fan @ 2022-06-22 16:34 UTC (permalink / raw)
To: David Marchand, dev; +Cc: Poczatek, Jakub, Maxime Coquelin, Xia, Chenbo
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Wednesday, June 22, 2022 4:30 PM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Poczatek, Jakub
> <jakub.poczatek@intel.com>; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>
> Subject: [PATCH] vhost/crypto: fix descriptor processing
>
> copy_data was returning a pointer to an increased (off by one) descriptor.
> Subsequent calls to copy_data in the library were then failing.
> Fix this by incrementing the descriptor only if there is some left data
> to copy.
>
> Fixes: 7287660a21e0 ("vhost/crypto: fix build with GCC 12")
>
> Reported-by: Jakub Poczatek <jakub.poczatek@intel.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> lib/vhost/vhost_crypto.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
> index 96ffb82a5d..54946f46d9 100644
> --- a/lib/vhost/vhost_crypto.c
> +++ b/lib/vhost/vhost_crypto.c
> @@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req
> *vc_req,
> return -1;
> left -= copied;
> data = RTE_PTR_ADD(data, copied);
> - desc++;
> - } while (desc < head + max_n_descs && left != 0);
> + } while (left != 0 && ++desc < head + max_n_descs);
>
> if (unlikely(left != 0))
> return -1;
> --
> 2.36.1
Thanks David.
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vhost/crypto: fix descriptor processing
2022-06-22 15:30 [PATCH] vhost/crypto: fix descriptor processing David Marchand
2022-06-22 15:34 ` Maxime Coquelin
2022-06-22 16:34 ` Zhang, Roy Fan
@ 2022-06-22 17:14 ` Maxime Coquelin
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2022-06-22 17:14 UTC (permalink / raw)
To: David Marchand, dev; +Cc: roy.fan.zhang, Jakub Poczatek, Chenbo Xia
On 6/22/22 17:30, David Marchand wrote:
> copy_data was returning a pointer to an increased (off by one) descriptor.
> Subsequent calls to copy_data in the library were then failing.
> Fix this by incrementing the descriptor only if there is some left data
> to copy.
>
> Fixes: 7287660a21e0 ("vhost/crypto: fix build with GCC 12")
>
> Reported-by: Jakub Poczatek <jakub.poczatek@intel.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> lib/vhost/vhost_crypto.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
Applied to dpdk-next-virtio/main.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-22 17:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 15:30 [PATCH] vhost/crypto: fix descriptor processing David Marchand
2022-06-22 15:34 ` Maxime Coquelin
2022-06-22 16:34 ` Zhang, Roy Fan
2022-06-22 17:14 ` Maxime Coquelin
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).