mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
qcacmn: Bound check while setting Spectral params
Do bounds check for some Spectral params and throw an error in case of any out of bound inputs. CRs-Fixed: 2449740 2449704 Change-Id: Ibc3159267076fa355ab3e50f2d8b0b1524ae444c
This commit is contained in:
parent
cfa662fba6
commit
64e320b697
2 changed files with 20 additions and 0 deletions
|
|
@ -1971,6 +1971,8 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
|
|||
TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3;
|
||||
spectral->tag_sscan_fft_exp = TLV_TAG_SEARCH_FFT_REPORT_GEN3;
|
||||
spectral->tlvhdr_size = SPECTRAL_PHYERR_TLVSIZE_GEN3;
|
||||
spectral->fft_size_min = SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3;
|
||||
spectral->fft_size_max = SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3;
|
||||
} else {
|
||||
spectral->spectral_gen = SPECTRAL_GEN2;
|
||||
spectral->hdr_sig_exp = SPECTRAL_PHYERR_SIGNATURE_GEN2;
|
||||
|
|
@ -1978,6 +1980,8 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
|
|||
TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN2;
|
||||
spectral->tag_sscan_fft_exp = TLV_TAG_SEARCH_FFT_REPORT_GEN2;
|
||||
spectral->tlvhdr_size = sizeof(struct spectral_phyerr_tlv_gen2);
|
||||
spectral->fft_size_min = SPECTRAL_PARAM_FFT_SIZE_MIN_GEN2;
|
||||
spectral->fft_size_max = SPECTRAL_PARAM_FFT_SIZE_MAX_GEN2;
|
||||
}
|
||||
|
||||
spectral->params_valid = false;
|
||||
|
|
@ -2106,6 +2110,9 @@ target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev,
|
|||
spectral->params.ss_spectral_pri = (!!value) ? true : false;
|
||||
break;
|
||||
case SPECTRAL_PARAM_FFT_SIZE:
|
||||
if ((value < spectral->fft_size_min) ||
|
||||
(value > spectral->fft_size_max))
|
||||
return -EINVAL;
|
||||
spectral->params.ss_fft_size = value;
|
||||
break;
|
||||
case SPECTRAL_PARAM_GC_ENA:
|
||||
|
|
@ -2139,6 +2146,9 @@ target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev,
|
|||
spectral->params.ss_pwr_format = !!value;
|
||||
break;
|
||||
case SPECTRAL_PARAM_RPT_MODE:
|
||||
if ((value < SPECTRAL_PARAM_RPT_MODE_MIN) ||
|
||||
(value > SPECTRAL_PARAM_RPT_MODE_MAX))
|
||||
return -EINVAL;
|
||||
spectral->params.ss_rpt_mode = value;
|
||||
break;
|
||||
case SPECTRAL_PARAM_BIN_SCALE:
|
||||
|
|
|
|||
|
|
@ -79,6 +79,14 @@
|
|||
#define OFFSET_CH_WIDTH_80 56
|
||||
#define OFFSET_CH_WIDTH_160 50
|
||||
|
||||
/* Min and max for relevant Spectral params */
|
||||
#define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN2 (1)
|
||||
#define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN2 (9)
|
||||
#define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3 (5)
|
||||
#define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3 (9)
|
||||
#define SPECTRAL_PARAM_RPT_MODE_MIN (0)
|
||||
#define SPECTRAL_PARAM_RPT_MODE_MAX (3)
|
||||
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
#define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) do { \
|
||||
int j; \
|
||||
|
|
@ -908,6 +916,8 @@ struct target_if_spectral {
|
|||
void *spectral_report_cache;
|
||||
uint32_t last_fft_timestamp;
|
||||
uint32_t timestamp_war_offset;
|
||||
uint16_t fft_size_min;
|
||||
uint16_t fft_size_max;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue