浏览代码

qcacld-3.0: Add compile time check for cRegTableEntries

The maximum value of the variable cRegTableEntries is defined in
MAX_CFG_INI_ITEMS. In the scenario the value is greater than this it
may cause an overrun may occur due to the weak guard.

Turn the runtime check into compile time check to prevent such scenario.

Change-Id: I58a0d47a32d457297d3caa456fd0ca03523ed9f5
CRs-Fixed: 2232723
Sourav Mohapatra 7 年之前
父节点
当前提交
2101268ece
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      core/hdd/src/wlan_hdd_cfg.c

+ 1 - 5
core/hdd/src/wlan_hdd_cfg.c

@@ -5724,11 +5724,7 @@ static QDF_STATUS hdd_apply_cfg_ini(struct hdd_context *hdd_ctx,
 	int i;
 	int rv;
 
-	if (MAX_CFG_INI_ITEMS < cRegTableEntries) {
-		hdd_err("MAX_CFG_INI_ITEMS too small, must be at least %ld",
-		       cRegTableEntries);
-		WARN_ON(1);
-	}
+	BUILD_BUG_ON(MAX_CFG_INI_ITEMS < cRegTableEntries);
 
 	for (idx = 0; idx < cRegTableEntries; idx++, pRegEntry++) {
 		/* Calculate the address of the destination field in the structure. */