OSDN Git Service

ASoC: SOF: fix range checks
authorGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Thu, 17 Sep 2020 10:56:32 +0000 (13:56 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 17 Sep 2020 14:53:20 +0000 (15:53 +0100)
commit0e4ea878708be903566ad93d4972ad3dd4c1c30e
treea8e55e074d3a1d6cf468073b9b413ecfed36236e
parentdb69bcf915a37d7b8e54acf5f67d09d8159eb616
ASoC: SOF: fix range checks

On multiple locations checks are performed of untrusted values after adding
a constant to them. This is wrong, because the addition might overflow and
the result can then pass the check, although the original value is invalid.
Fix multiple such issues by checking the actual value and not a sum of it
and a constant.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917105633.2579047-8-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/control.c
sound/soc/sof/topology.c