From 512104fbe5182909d2787998925b61681803ff11 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Thu, 27 Jun 2019 13:10:49 +0530 Subject: [PATCH] qcacmn: Avoid NULL pointer access In function reg_dmn_print_channels_in_opclass, check for NULL pointer of the variable class before dereferencing. Change-Id: I6a17bf85b0a3dfbe1af9434583f31c96c268cc98 CRs-Fixed: 2470338 --- umac/regulatory/core/src/reg_opclass.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/umac/regulatory/core/src/reg_opclass.c b/umac/regulatory/core/src/reg_opclass.c index 225addbaa1..e5150fc6f6 100644 --- a/umac/regulatory/core/src/reg_opclass.c +++ b/umac/regulatory/core/src/reg_opclass.c @@ -217,7 +217,13 @@ void reg_dmn_print_channels_in_opclass(uint8_t *country, uint8_t op_class) uint16_t i = 0; class = reg_get_class_from_country(country); - while (class && class->op_class) { + + if (!class) { + reg_err("class is NULL"); + return; + } + + while (class->op_class) { if (class->op_class == op_class) { for (i = 0; (i < REG_MAX_CHANNELS_PER_OPERATING_CLASS &&