Commit e180a01
wifi: ath12k: Add NULL check to validate tpc_stats
While processing TPC stats received from firmware, there are chances that
the tpc_stats might not be filled and the data is not available. This can
happen under two scenarios. First, when firmware sends a non-zero event
count before event count 0. When this happens, tpc_stats will be checked
for data before memory allocation and the tpc_stats will be unavailable.
Second, when memory allocation failed when event count received is 0 and
the firmware still sends a non-zero event. When this happens, memory will
not be allocated for tpc_stats though event count is 0, so when non-zero
event count is received, tpc_stats will be empty. There are checks to
validate if tpc_stats variable is filled that are used in two subsequent
places, but these are placed after tpc_stats is dereference without
checking if it is NULL or has valid data.
Fix this by removing the mentioned checks and adding a NULL check after
assigning tpc_stats to check if it is valid.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Closes: https://scan7.scan.coverity.com/#/project-view/52668/11354?selectedIssue=1637145
Fixes: f0c3bb7 ("wifi: ath12k: Add Support to Parse TPC Event from Firmware")
Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250221041250.769491-1-quic_rdevanat@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>1 parent 11d963d commit e180a01
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8442 | 8442 | | |
8443 | 8443 | | |
8444 | 8444 | | |
| 8445 | + | |
| 8446 | + | |
| 8447 | + | |
| 8448 | + | |
8445 | 8449 | | |
8446 | 8450 | | |
8447 | 8451 | | |
| |||
8460 | 8464 | | |
8461 | 8465 | | |
8462 | 8466 | | |
8463 | | - | |
8464 | | - | |
| 8467 | + | |
8465 | 8468 | | |
8466 | 8469 | | |
8467 | 8470 | | |
8468 | 8471 | | |
8469 | | - | |
| 8472 | + | |
8470 | 8473 | | |
8471 | 8474 | | |
8472 | 8475 | | |
| |||
0 commit comments