* tegra210_adsp_alt.c - Tegra ADSP audio driver
*
* Author: Sumit Bhattacharya <sumitb@nvidia.com>
- * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
dev_warn(adsp->dev, "No params to pass to the plugin\n");
return 0;
}
+
+ if (num_params + 2 >
+ sizeof(apm_msg.msg.fx_set_param_params.params)/
+ sizeof(apm_msg.msg.fx_set_param_params.params[0])) {
+ dev_err(adsp->dev, "parameter too large\n");
+ return -EINVAL;
+ }
+
apm_msg.msg.fx_set_param_params.params[0] =
(sizeof(nvfx_call_params_t) +
num_params * sizeof(int32_t));
nvfx_call_params_t *call_params =
(nvfx_call_params_t *)ucontrol->value.bytes.data;
+ if (call_params->size >
+ sizeof(apm_msg.msg.fx_set_param_params.params)) {
+ dev_err(adsp->dev, "parameter too large\n");
+ return -EINVAL;
+ }
+
/* copy parameters */
memcpy(&apm_msg.msg.fx_set_param_params.params,
call_params, call_params->size);