ASoC: msm-cpe: Fix range checking in function fw_name_store
The range checking between "WCD_CPE_IMAGE_FNAME_MAX" and "copy_count" is off-by-one due to the size of array "core->dyn_fname" is "WCD_CPE_IMAGE_FNAME_MAX". Subtract one from the range checking to fix this issue. Change-Id: I87fd55206f79ad7b13c3878f6642bf5579303b17 Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
This commit is contained in:
parent
75a9d0fee5
commit
0c53b526c0
1 changed files with 2 additions and 2 deletions
|
@ -1731,10 +1731,10 @@ static ssize_t fw_name_store(struct wcd_cpe_core *core,
|
|||
if (pos)
|
||||
copy_count = pos - buf;
|
||||
|
||||
if (copy_count > WCD_CPE_IMAGE_FNAME_MAX) {
|
||||
if (copy_count > (WCD_CPE_IMAGE_FNAME_MAX - 1)) {
|
||||
dev_err(core->dev,
|
||||
"%s: Invalid length %d, max allowed %d\n",
|
||||
__func__, copy_count, WCD_CPE_IMAGE_FNAME_MAX);
|
||||
__func__, copy_count, WCD_CPE_IMAGE_FNAME_MAX - 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue