crypto/qat: fix access to null pointer

Message ID 20211103150843.3235347-1-przemyslawx.zegan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/qat: fix access to null pointer |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues

Commit Message

Przemyslaw Zegan Nov. 3, 2021, 3:08 p.m. UTC
  This patch fixes a possible access to null pointer

Fixes: 9f4b9222019c ("common/qat: add gen specific queue implementation")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
 drivers/common/qat/dev/qat_dev_gen1.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Arkadiusz Kusztal Nov. 3, 2021, 6:03 p.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Przemyslaw Zegan
> Sent: Wednesday, November 3, 2021 4:09 PM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Zegan,
> PrzemyslawX <przemyslawx.zegan@intel.com>
> Subject: [dpdk-dev] [PATCH] crypto/qat: fix access to null pointer
> 
> This patch fixes a possible access to null pointer
> 
> Fixes: 9f4b9222019c ("common/qat: add gen specific queue implementation")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>

Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
  
Akhil Goyal Nov. 4, 2021, 11:47 a.m. UTC | #2
> This patch fixes a possible access to null pointer
> 
> Fixes: 9f4b9222019c ("common/qat: add gen specific queue
> implementation")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
Patch squashed to original patch as it was not merged.
Fixed check patch error.
  

Patch

diff --git a/drivers/common/qat/dev/qat_dev_gen1.c b/drivers/common/qat/dev/qat_dev_gen1.c
index ed4c4a2c03..f15238cc23 100644
--- a/drivers/common/qat/dev/qat_dev_gen1.c
+++ b/drivers/common/qat/dev/qat_dev_gen1.c
@@ -92,6 +92,9 @@  qat_qp_rings_per_service_gen1(struct qat_pci_device *qat_dev,
 	for (i = 0; i < ADF_MAX_QPS_ON_ANY_SERVICE; i++) {
 		const struct qat_qp_hw_data *hw_qps =
 				qat_qp_get_hw_data(qat_dev, service, i);
+
+		if(hw_qps == NULL)
+			continue;
 		if (hw_qps->service_type == service)
 			count++;
 	}