qcacld-3.0: Fix logging signed integer cfg item

A signed integer cfg item if less that 32 bits is logged
improperly i.e. the sign of the cfg item is being lost.
Fix this by preserving the sign.

Change-Id: I6eaba2bfa06d763bcdf197de0a4182c12c74d1af
CRs-Fixed: 2033298
This commit is contained in:
Vidyullatha Kanchanapally 2017-04-13 19:16:24 +05:30 • committed by snandini
commit 53241c46d5

View file

@ -4441,12 +4441,23 @@ static QDF_STATUS hdd_cfg_get_config(struct reg_table_entry *reg_table,
(WLAN_PARAM_SignedInteger == pRegEntry->RegType) ||
(WLAN_PARAM_HexInteger == pRegEntry->RegType)) {
value = 0;
if ((pRegEntry->VarSize > sizeof(value)) ||
(pRegEntry->VarSize == 0)) {
pr_warn("Invalid length of %s: %d",
pRegEntry->RegName, pRegEntry->VarSize);
continue;
}
memcpy(&value, pField, pRegEntry->VarSize);
if (WLAN_PARAM_HexInteger == pRegEntry->RegType) {
fmt = "%x";
} else if (WLAN_PARAM_SignedInteger ==
pRegEntry->RegType) {
fmt = "%d";
value = sign_extend32(
value,
pRegEntry->VarSize * 8 - 1);
} else {
fmt = "%u";
}