From ff5dc2f1f670f30c6e0d293896caf77c426f160e Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Mon, 31 Aug 2020 18:58:10 -0500 Subject: [PATCH 1/2] fixup! ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO remove cast as suggested by Marc Herbert Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index b7dc430f52e88f..f90dd11334a6b6 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -390,7 +390,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", cdata->data->size, - (size_t)be->max - sizeof(const struct sof_abi_hdr)); + be->max - sizeof(const struct sof_abi_hdr)); ret = -EINVAL; goto out; } From e6a2ab3ab7a225e087fdc0c4366845df47d8d6e9 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Mon, 31 Aug 2020 18:59:15 -0500 Subject: [PATCH 2/2] fixup! ASoC: SOF: fix range checks Remove explicit cast as suggested by Marc Herbert Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/control.c | 6 +++--- sound/soc/sof/topology.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index f90dd11334a6b6..1ef68595c0f72f 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -233,7 +233,7 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, if (data->size > be->max - sizeof(*data)) { dev_err_ratelimited(scomp->dev, "error: %u bytes of control data is invalid, max is %zu\n", - data->size, (size_t)be->max - sizeof(*data)); + data->size, be->max - sizeof(*data)); return -EINVAL; } @@ -267,7 +267,7 @@ int snd_sof_bytes_put(struct snd_kcontrol *kcontrol, if (data->size > be->max - sizeof(*data)) { dev_err_ratelimited(scomp->dev, "error: data size too big %u bytes max is %zu\n", - data->size, (size_t)be->max - sizeof(*data)); + data->size, be->max - sizeof(*data)); return -EINVAL; } @@ -443,7 +443,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", cdata->data->size, - (size_t)be->max - sizeof(const struct sof_abi_hdr)); + be->max - sizeof(const struct sof_abi_hdr)); return -EINVAL; } diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 3fdce50aa07e21..1849178c8b624c 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1163,7 +1163,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, /* init the get/put bytes data */ if (priv_size > max_size - sizeof(struct sof_ipc_ctrl_data)) { dev_err(scomp->dev, "err: bytes data size %zu exceeds max %zu.\n", - priv_size, (size_t)max_size - sizeof(struct sof_ipc_ctrl_data)); + priv_size, max_size - sizeof(struct sof_ipc_ctrl_data)); ret = -EINVAL; goto out; }