* [PATCH] common/qat: fix incorrect size in the parser
@ 2025-02-07 9:58 Arkadiusz Kusztal
2025-02-19 9:41 ` Dooley, Brian
0 siblings, 1 reply; 3+ messages in thread
From: Arkadiusz Kusztal @ 2025-02-07 9:58 UTC (permalink / raw)
To: dev; +Cc: gakhil, brian.dooley, Arkadiusz Kusztal, stable
The function `strlen` returns the size of the string without a terminating
null-character, therefore a request to allocate memory space for a parsed
argument is too small by 1.
Fixes: 99ab2806687b ("common/qat: isolate parser arguments configuration")
Cc: stable@dpdk.org
Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
drivers/common/qat/qat_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index bca88fd9bd..746d8a28bb 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -226,7 +226,7 @@ qat_dev_parse_command_line(struct qat_pci_device *qat_dev,
if (!devargs)
return 0;
- len = strlen(devargs->drv_str);
+ len = strlen(devargs->drv_str) + 1;
if (len == 0)
return 0;
/* Allocate per-device command line */
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] common/qat: fix incorrect size in the parser
2025-02-07 9:58 [PATCH] common/qat: fix incorrect size in the parser Arkadiusz Kusztal
@ 2025-02-19 9:41 ` Dooley, Brian
2025-03-02 19:14 ` Akhil Goyal
0 siblings, 1 reply; 3+ messages in thread
From: Dooley, Brian @ 2025-02-19 9:41 UTC (permalink / raw)
To: Kusztal, ArkadiuszX, dev; +Cc: gakhil, stable
> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Friday 7 February 2025 09:59
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Dooley, Brian <brian.dooley@intel.com>; Kusztal,
> ArkadiuszX <arkadiuszx.kusztal@intel.com>; stable@dpdk.org
> Subject: [PATCH] common/qat: fix incorrect size in the parser
>
> The function `strlen` returns the size of the string without a terminating null-
> character, therefore a request to allocate memory space for a parsed argument
> is too small by 1.
>
> Fixes: 99ab2806687b ("common/qat: isolate parser arguments
> configuration")
> Cc: stable@dpdk.org
>
> Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> ---
> drivers/common/qat/qat_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/common/qat/qat_device.c
> b/drivers/common/qat/qat_device.c index bca88fd9bd..746d8a28bb
> 100644
> --- a/drivers/common/qat/qat_device.c
> +++ b/drivers/common/qat/qat_device.c
> @@ -226,7 +226,7 @@ qat_dev_parse_command_line(struct qat_pci_device
> *qat_dev,
> if (!devargs)
> return 0;
>
> - len = strlen(devargs->drv_str);
> + len = strlen(devargs->drv_str) + 1;
> if (len == 0)
> return 0;
> /* Allocate per-device command line */
> --
> 2.34.1
Acked-by: Brian Dooley <brian.dooley@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] common/qat: fix incorrect size in the parser
2025-02-19 9:41 ` Dooley, Brian
@ 2025-03-02 19:14 ` Akhil Goyal
0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2025-03-02 19:14 UTC (permalink / raw)
To: Dooley, Brian, Kusztal, ArkadiuszX, dev; +Cc: stable
> > Subject: [PATCH] common/qat: fix incorrect size in the parser
> >
> > The function `strlen` returns the size of the string without a terminating null-
> > character, therefore a request to allocate memory space for a parsed argument
> > is too small by 1.
> >
> > Fixes: 99ab2806687b ("common/qat: isolate parser arguments
> > configuration")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> > ---
> > drivers/common/qat/qat_device.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/common/qat/qat_device.c
> > b/drivers/common/qat/qat_device.c index bca88fd9bd..746d8a28bb
> > 100644
> > --- a/drivers/common/qat/qat_device.c
> > +++ b/drivers/common/qat/qat_device.c
> > @@ -226,7 +226,7 @@ qat_dev_parse_command_line(struct qat_pci_device
> > *qat_dev,
> > if (!devargs)
> > return 0;
> >
> > - len = strlen(devargs->drv_str);
> > + len = strlen(devargs->drv_str) + 1;
> > if (len == 0)
> > return 0;
Once len increased by 1, above check is redundant.
You should increment length after if check
> > /* Allocate per-device command line */
> > --
> > 2.34.1
>
> Acked-by: Brian Dooley <brian.dooley@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-02 19:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-07 9:58 [PATCH] common/qat: fix incorrect size in the parser Arkadiusz Kusztal
2025-02-19 9:41 ` Dooley, Brian
2025-03-02 19:14 ` Akhil Goyal
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).