[1/4] event/dlb: fix memory overrun Coverity warning

Message ID 1604611374-2072-3-git-send-email-timothy.mcdaniel@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/4] event/dlb: fix memory overrun Coverity warning |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Timothy McDaniel Nov. 5, 2020, 9:22 p.m. UTC
  Fix memory corruption bug caused by passing address of a 16b value,
instead of address of a 32b value.

Fixes: 1998008 ("event/dlb: add eventdev probe")
Coverity issue: 363715
Cc: stable@dpdk.org

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb/pf/dlb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Jerin Jacob Nov. 10, 2020, 3:36 p.m. UTC | #1
On Fri, Nov 6, 2020 at 2:51 AM Timothy McDaniel
<timothy.mcdaniel@intel.com> wrote:
>
> Fix memory corruption bug caused by passing address of a 16b value,
> instead of address of a 32b value.
>
> Fixes: 1998008 ("event/dlb: add eventdev probe")
> Coverity issue: 363715
> Cc: stable@dpdk.org
>
> Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>

Series applied to dpdk-next-eventdev/for-main. Thanks.


> ---
>  drivers/event/dlb/pf/dlb_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/event/dlb/pf/dlb_main.c b/drivers/event/dlb/pf/dlb_main.c
> index 87ab8dd..17e671e 100644
> --- a/drivers/event/dlb/pf/dlb_main.c
> +++ b/drivers/event/dlb/pf/dlb_main.c
> @@ -250,13 +250,13 @@ dlb_pf_reset(struct dlb_dev *dlb_dev)
>  {
>         int msix_cap_offset, err_cap_offset, acs_cap_offset, wait_count;
>         uint16_t dev_ctl_word, dev_ctl2_word, lnk_word, lnk_word2;
> -       uint16_t rt_ctl_word, pri_reqs_dword,  pri_ctrl_word;
> +       uint16_t rt_ctl_word, pri_ctrl_word;
>         struct rte_pci_device *pdev = dlb_dev->pdev;
>         uint16_t devsta_busy_word, devctl_word;
>         int pcie_cap_offset, pri_cap_offset;
>         uint16_t slt_word, slt_word2, cmd;
>         int ret = 0, i = 0;
> -       uint32_t dword[16];
> +       uint32_t dword[16], pri_reqs_dword;
>         off_t off;
>
>         /* Save PCI config state */
> --
> 2.6.4
>
  
Timothy McDaniel Nov. 10, 2020, 3:44 p.m. UTC | #2
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Tuesday, November 10, 2020 9:36 AM
> To: McDaniel, Timothy <timothy.mcdaniel@intel.com>
> Cc: Eads, Gage <gage.eads@intel.com>; dpdk-dev <dev@dpdk.org>; Carrillo,
> Erik G <erik.g.carrillo@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Jerin Jacob <jerinj@marvell.com>;
> john.mcnamara@dpdk.org; dpdk stable <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH 1/4] event/dlb: fix memory overrun Coverity
> warning
> 
> On Fri, Nov 6, 2020 at 2:51 AM Timothy McDaniel
> <timothy.mcdaniel@intel.com> wrote:
> >
> > Fix memory corruption bug caused by passing address of a 16b value,
> > instead of address of a 32b value.
> >
> > Fixes: 1998008 ("event/dlb: add eventdev probe")
> > Coverity issue: 363715
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
> 
> Series applied to dpdk-next-eventdev/for-main. Thanks.
> 

Thank you, Jerin.

> 
> > ---
> >  drivers/event/dlb/pf/dlb_main.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/event/dlb/pf/dlb_main.c b/drivers/event/dlb/pf/dlb_main.c
> > index 87ab8dd..17e671e 100644
> > --- a/drivers/event/dlb/pf/dlb_main.c
> > +++ b/drivers/event/dlb/pf/dlb_main.c
> > @@ -250,13 +250,13 @@ dlb_pf_reset(struct dlb_dev *dlb_dev)
> >  {
> >         int msix_cap_offset, err_cap_offset, acs_cap_offset, wait_count;
> >         uint16_t dev_ctl_word, dev_ctl2_word, lnk_word, lnk_word2;
> > -       uint16_t rt_ctl_word, pri_reqs_dword,  pri_ctrl_word;
> > +       uint16_t rt_ctl_word, pri_ctrl_word;
> >         struct rte_pci_device *pdev = dlb_dev->pdev;
> >         uint16_t devsta_busy_word, devctl_word;
> >         int pcie_cap_offset, pri_cap_offset;
> >         uint16_t slt_word, slt_word2, cmd;
> >         int ret = 0, i = 0;
> > -       uint32_t dword[16];
> > +       uint32_t dword[16], pri_reqs_dword;
> >         off_t off;
> >
> >         /* Save PCI config state */
> > --
> > 2.6.4
> >
  

Patch

diff --git a/drivers/event/dlb/pf/dlb_main.c b/drivers/event/dlb/pf/dlb_main.c
index 87ab8dd..17e671e 100644
--- a/drivers/event/dlb/pf/dlb_main.c
+++ b/drivers/event/dlb/pf/dlb_main.c
@@ -250,13 +250,13 @@  dlb_pf_reset(struct dlb_dev *dlb_dev)
 {
 	int msix_cap_offset, err_cap_offset, acs_cap_offset, wait_count;
 	uint16_t dev_ctl_word, dev_ctl2_word, lnk_word, lnk_word2;
-	uint16_t rt_ctl_word, pri_reqs_dword,  pri_ctrl_word;
+	uint16_t rt_ctl_word, pri_ctrl_word;
 	struct rte_pci_device *pdev = dlb_dev->pdev;
 	uint16_t devsta_busy_word, devctl_word;
 	int pcie_cap_offset, pri_cap_offset;
 	uint16_t slt_word, slt_word2, cmd;
 	int ret = 0, i = 0;
-	uint32_t dword[16];
+	uint32_t dword[16], pri_reqs_dword;
 	off_t off;
 
 	/* Save PCI config state */