* [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access
@ 2022-07-27 14:42 ` Vijendar Mukunda
0 siblings, 0 replies; 12+ messages in thread
From: Vijendar Mukunda @ 2022-07-27 14:42 UTC (permalink / raw)
To: dri-devel, amd-gfx
Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list,
Daniel Vetter, Vijendar Mukunda, Alex Deucher,
Christian König, dan.carpenter
Fixed following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init()
error: buffer overflow 'i2s_pdata' 3 <= 3
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init()
error: buffer overflow 'i2s_pdata' 3 <= 3
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index bcc7ee02e0fc..6d72355ac492 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -390,14 +390,6 @@ static int acp_hw_init(void *handle)
i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET;
i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET;
- i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET;
- switch (adev->asic_type) {
- case CHIP_STONEY:
- i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE;
- break;
- default:
- break;
- }
adev->acp.acp_res[0].name = "acp2x_dma";
adev->acp.acp_res[0].flags = IORESOURCE_MEM;
adev->acp.acp_res[0].start = acp_base;
--
2.25.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 14:42 ` Vijendar Mukunda 0 siblings, 0 replies; 12+ messages in thread From: Vijendar Mukunda @ 2022-07-27 14:42 UTC (permalink / raw) To: dri-devel, amd-gfx Cc: Alexander.Deucher, Sunil-kumar.Dommati, dan.carpenter, Vijendar Mukunda, Alex Deucher, Christian König, Pan, Xinhui, David Airlie, Daniel Vetter, open list Fixed following Smatch static checker warning: drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() error: buffer overflow 'i2s_pdata' 3 <= 3 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() error: buffer overflow 'i2s_pdata' 3 <= 3 Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index bcc7ee02e0fc..6d72355ac492 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; - switch (adev->asic_type) { - case CHIP_STONEY: - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; - break; - default: - break; - } adev->acp.acp_res[0].name = "acp2x_dma"; adev->acp.acp_res[0].flags = IORESOURCE_MEM; adev->acp.acp_res[0].start = acp_base; -- 2.25.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 14:42 ` Vijendar Mukunda 0 siblings, 0 replies; 12+ messages in thread From: Vijendar Mukunda @ 2022-07-27 14:42 UTC (permalink / raw) To: dri-devel, amd-gfx Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, Vijendar Mukunda, Alex Deucher, Christian König, dan.carpenter Fixed following Smatch static checker warning: drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() error: buffer overflow 'i2s_pdata' 3 <= 3 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() error: buffer overflow 'i2s_pdata' 3 <= 3 Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index bcc7ee02e0fc..6d72355ac492 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; - switch (adev->asic_type) { - case CHIP_STONEY: - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; - break; - default: - break; - } adev->acp.acp_res[0].name = "acp2x_dma"; adev->acp.acp_res[0].flags = IORESOURCE_MEM; adev->acp.acp_res[0].start = acp_base; -- 2.25.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access 2022-07-27 14:42 ` Vijendar Mukunda (?) @ 2022-07-27 14:55 ` Alex Deucher -1 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 14:55 UTC (permalink / raw) To: Vijendar Mukunda Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda <Vijendar.Mukunda@amd.com> wrote: > > Fixed following Smatch static checker warning: > > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > index bcc7ee02e0fc..6d72355ac492 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > > - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > - switch (adev->asic_type) { > - case CHIP_STONEY: > - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > - break; > - default: > - break; > - } Is this actually not used or should we just increase the allocation size? Alex > adev->acp.acp_res[0].name = "acp2x_dma"; > adev->acp.acp_res[0].flags = IORESOURCE_MEM; > adev->acp.acp_res[0].start = acp_base; > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 14:55 ` Alex Deucher 0 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 14:55 UTC (permalink / raw) To: Vijendar Mukunda Cc: dri-devel, amd-gfx, Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda <Vijendar.Mukunda@amd.com> wrote: > > Fixed following Smatch static checker warning: > > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > index bcc7ee02e0fc..6d72355ac492 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > > - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > - switch (adev->asic_type) { > - case CHIP_STONEY: > - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > - break; > - default: > - break; > - } Is this actually not used or should we just increase the allocation size? Alex > adev->acp.acp_res[0].name = "acp2x_dma"; > adev->acp.acp_res[0].flags = IORESOURCE_MEM; > adev->acp.acp_res[0].start = acp_base; > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 14:55 ` Alex Deucher 0 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 14:55 UTC (permalink / raw) To: Vijendar Mukunda Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda <Vijendar.Mukunda@amd.com> wrote: > > Fixed following Smatch static checker warning: > > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > error: buffer overflow 'i2s_pdata' 3 <= 3 > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > index bcc7ee02e0fc..6d72355ac492 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > > - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > - switch (adev->asic_type) { > - case CHIP_STONEY: > - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > - break; > - default: > - break; > - } Is this actually not used or should we just increase the allocation size? Alex > adev->acp.acp_res[0].name = "acp2x_dma"; > adev->acp.acp_res[0].flags = IORESOURCE_MEM; > adev->acp.acp_res[0].start = acp_base; > -- > 2.25.1 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access 2022-07-27 14:55 ` Alex Deucher (?) @ 2022-07-27 15:20 ` Mukunda,Vijendar -1 siblings, 0 replies; 12+ messages in thread From: Mukunda,Vijendar @ 2022-07-27 15:20 UTC (permalink / raw) To: Alex Deucher Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On 7/27/22 8:25 PM, Alex Deucher wrote: > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > <Vijendar.Mukunda@amd.com> wrote: >> >> Fixed following Smatch static checker warning: >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- >> 1 file changed, 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> index bcc7ee02e0fc..6d72355ac492 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; >> >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; >> - switch (adev->asic_type) { >> - case CHIP_STONEY: >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; >> - break; >> - default: >> - break; >> - } > > Is this actually not used or should we just increase the allocation size? > > Alex it's my bad. i2s_pdata array size is 3. when we recently included code changes for JD platform , this piece of code was added mistakenly for Stoney platform switch case. -- Vijendar > >> adev->acp.acp_res[0].name = "acp2x_dma"; >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; >> adev->acp.acp_res[0].start = acp_base; >> -- >> 2.25.1 >> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 15:20 ` Mukunda,Vijendar 0 siblings, 0 replies; 12+ messages in thread From: Mukunda,Vijendar @ 2022-07-27 15:20 UTC (permalink / raw) To: Alex Deucher Cc: dri-devel, amd-gfx, Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On 7/27/22 8:25 PM, Alex Deucher wrote: > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > <Vijendar.Mukunda@amd.com> wrote: >> >> Fixed following Smatch static checker warning: >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- >> 1 file changed, 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> index bcc7ee02e0fc..6d72355ac492 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; >> >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; >> - switch (adev->asic_type) { >> - case CHIP_STONEY: >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; >> - break; >> - default: >> - break; >> - } > > Is this actually not used or should we just increase the allocation size? > > Alex it's my bad. i2s_pdata array size is 3. when we recently included code changes for JD platform , this piece of code was added mistakenly for Stoney platform switch case. -- Vijendar > >> adev->acp.acp_res[0].name = "acp2x_dma"; >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; >> adev->acp.acp_res[0].start = acp_base; >> -- >> 2.25.1 >> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 15:20 ` Mukunda,Vijendar 0 siblings, 0 replies; 12+ messages in thread From: Mukunda,Vijendar @ 2022-07-27 15:20 UTC (permalink / raw) To: Alex Deucher Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Alex Deucher, Christian König, dan.carpenter On 7/27/22 8:25 PM, Alex Deucher wrote: > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > <Vijendar.Mukunda@amd.com> wrote: >> >> Fixed following Smatch static checker warning: >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() >> error: buffer overflow 'i2s_pdata' 3 <= 3 >> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- >> 1 file changed, 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> index bcc7ee02e0fc..6d72355ac492 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; >> >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; >> - switch (adev->asic_type) { >> - case CHIP_STONEY: >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; >> - break; >> - default: >> - break; >> - } > > Is this actually not used or should we just increase the allocation size? > > Alex it's my bad. i2s_pdata array size is 3. when we recently included code changes for JD platform , this piece of code was added mistakenly for Stoney platform switch case. -- Vijendar > >> adev->acp.acp_res[0].name = "acp2x_dma"; >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; >> adev->acp.acp_res[0].start = acp_base; >> -- >> 2.25.1 >> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access 2022-07-27 15:20 ` Mukunda,Vijendar (?) @ 2022-07-27 15:22 ` Alex Deucher -1 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 15:22 UTC (permalink / raw) To: Mukunda,Vijendar Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 11:16 AM Mukunda,Vijendar <vijendar.mukunda@amd.com> wrote: > > On 7/27/22 8:25 PM, Alex Deucher wrote: > > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > > <Vijendar.Mukunda@amd.com> wrote: > >> > >> Fixed following Smatch static checker warning: > >> > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> > >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > >> --- > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > >> 1 file changed, 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> index bcc7ee02e0fc..6d72355ac492 100644 > >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > >> > >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > >> - switch (adev->asic_type) { > >> - case CHIP_STONEY: > >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > >> - break; > >> - default: > >> - break; > >> - } > > > > Is this actually not used or should we just increase the allocation size? > > > > Alex > it's my bad. i2s_pdata array size is 3. when we recently included code > changes for JD platform , this piece of code was added mistakenly for > Stoney platform switch case. Thanks. Patch is: Acked-by: Alex Deucher <alexander.deucher@amd.com> > > -- > Vijendar > > > > >> adev->acp.acp_res[0].name = "acp2x_dma"; > >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; > >> adev->acp.acp_res[0].start = acp_base; > >> -- > >> 2.25.1 > >> > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 15:22 ` Alex Deucher 0 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 15:22 UTC (permalink / raw) To: Mukunda,Vijendar Cc: dri-devel, amd-gfx, Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, Daniel Vetter, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 11:16 AM Mukunda,Vijendar <vijendar.mukunda@amd.com> wrote: > > On 7/27/22 8:25 PM, Alex Deucher wrote: > > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > > <Vijendar.Mukunda@amd.com> wrote: > >> > >> Fixed following Smatch static checker warning: > >> > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> > >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > >> --- > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > >> 1 file changed, 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> index bcc7ee02e0fc..6d72355ac492 100644 > >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > >> > >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > >> - switch (adev->asic_type) { > >> - case CHIP_STONEY: > >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > >> - break; > >> - default: > >> - break; > >> - } > > > > Is this actually not used or should we just increase the allocation size? > > > > Alex > it's my bad. i2s_pdata array size is 3. when we recently included code > changes for JD platform , this piece of code was added mistakenly for > Stoney platform switch case. Thanks. Patch is: Acked-by: Alex Deucher <alexander.deucher@amd.com> > > -- > Vijendar > > > > >> adev->acp.acp_res[0].name = "acp2x_dma"; > >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; > >> adev->acp.acp_res[0].start = acp_base; > >> -- > >> 2.25.1 > >> > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access @ 2022-07-27 15:22 ` Alex Deucher 0 siblings, 0 replies; 12+ messages in thread From: Alex Deucher @ 2022-07-27 15:22 UTC (permalink / raw) To: Mukunda,Vijendar Cc: Sunil-kumar.Dommati, David Airlie, Pan, Xinhui, open list, amd-gfx, dri-devel, Alex Deucher, Christian König, dan.carpenter On Wed, Jul 27, 2022 at 11:16 AM Mukunda,Vijendar <vijendar.mukunda@amd.com> wrote: > > On 7/27/22 8:25 PM, Alex Deucher wrote: > > On Wed, Jul 27, 2022 at 10:42 AM Vijendar Mukunda > > <Vijendar.Mukunda@amd.com> wrote: > >> > >> Fixed following Smatch static checker warning: > >> > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:393 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c:396 acp_hw_init() > >> error: buffer overflow 'i2s_pdata' 3 <= 3 > >> > >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > >> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > >> --- > >> drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 8 -------- > >> 1 file changed, 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> index bcc7ee02e0fc..6d72355ac492 100644 > >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c > >> @@ -390,14 +390,6 @@ static int acp_hw_init(void *handle) > >> i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET; > >> i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET; > >> > >> - i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET; > >> - switch (adev->asic_type) { > >> - case CHIP_STONEY: > >> - i2s_pdata[3].quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE; > >> - break; > >> - default: > >> - break; > >> - } > > > > Is this actually not used or should we just increase the allocation size? > > > > Alex > it's my bad. i2s_pdata array size is 3. when we recently included code > changes for JD platform , this piece of code was added mistakenly for > Stoney platform switch case. Thanks. Patch is: Acked-by: Alex Deucher <alexander.deucher@amd.com> > > -- > Vijendar > > > > >> adev->acp.acp_res[0].name = "acp2x_dma"; > >> adev->acp.acp_res[0].flags = IORESOURCE_MEM; > >> adev->acp.acp_res[0].start = acp_base; > >> -- > >> 2.25.1 > >> > ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-07-27 15:23 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-07-27 14:42 [PATCH] drm/amdgpu: fix i2s_pdata out of bound array access Vijendar Mukunda 2022-07-27 14:42 ` Vijendar Mukunda 2022-07-27 14:42 ` Vijendar Mukunda 2022-07-27 14:55 ` Alex Deucher 2022-07-27 14:55 ` Alex Deucher 2022-07-27 14:55 ` Alex Deucher 2022-07-27 15:20 ` Mukunda,Vijendar 2022-07-27 15:20 ` Mukunda,Vijendar 2022-07-27 15:20 ` Mukunda,Vijendar 2022-07-27 15:22 ` Alex Deucher 2022-07-27 15:22 ` Alex Deucher 2022-07-27 15:22 ` Alex Deucher
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.