From: Pierre-Louis Bossart Date: Wed, 30 Sep 2020 15:20:23 +0000 (+0300) Subject: ASoC: SOF: control: remove const in sizeof() X-Git-Tag: v5.15~1735^2~15^2~199^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5027fe36032a1203d5a56bd8c0f9279feb48775f;p=platform%2Fkernel%2Flinux-starfive.git ASoC: SOF: control: remove const in sizeof() We should only use the type, the const attribute makes no sense in sizeof(). Reported-by: Guennadi Liakhovetski Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Guennadi Liakhovetski Signed-off-by: Kai Vehmanen Acked-by: Jaroslav Kysela Tested-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20200930152026.3902186-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index 0352d2b..056c86a 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -309,7 +309,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol, * the length (as bytes) is needed to know the correct copy * length of data from tlvd->tlv. */ - if (copy_from_user(&header, tlvd, sizeof(const struct snd_ctl_tlv))) + if (copy_from_user(&header, tlvd, sizeof(struct snd_ctl_tlv))) return -EFAULT; /* make sure TLV info is consistent */ @@ -351,7 +351,7 @@ int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol, } /* be->max has been verified to be >= sizeof(struct sof_abi_hdr) */ - if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { + if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) { dev_err_ratelimited(scomp->dev, "error: Mismatch in ABI data size (truncated?).\n"); return -EINVAL; } @@ -405,15 +405,15 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ goto out; /* check data size doesn't exceed max coming from topology */ - if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { + if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) { dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", cdata->data->size, - be->max - sizeof(const struct sof_abi_hdr)); + be->max - sizeof(struct sof_abi_hdr)); ret = -EINVAL; goto out; } - data_size = cdata->data->size + sizeof(const struct sof_abi_hdr); + data_size = cdata->data->size + sizeof(struct sof_abi_hdr); /* make sure we don't exceed size provided by user space for data */ if (data_size > size) { @@ -423,7 +423,7 @@ int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int _ header.numid = scontrol->cmd; header.length = data_size; - if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv))) { + if (copy_to_user(tlvd, &header, sizeof(struct snd_ctl_tlv))) { ret = -EFAULT; goto out; } @@ -466,14 +466,14 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, cdata->data->abi = SOF_ABI_VERSION; /* check data size doesn't exceed max coming from topology */ - if (cdata->data->size > be->max - sizeof(const struct sof_abi_hdr)) { + if (cdata->data->size > be->max - sizeof(struct sof_abi_hdr)) { dev_err_ratelimited(scomp->dev, "error: user data size %d exceeds max size %zu.\n", cdata->data->size, - be->max - sizeof(const struct sof_abi_hdr)); + be->max - sizeof(struct sof_abi_hdr)); return -EINVAL; } - data_size = cdata->data->size + sizeof(const struct sof_abi_hdr); + data_size = cdata->data->size + sizeof(struct sof_abi_hdr); /* make sure we don't exceed size provided by user space for data */ if (data_size > size) @@ -481,7 +481,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol, header.numid = scontrol->cmd; header.length = data_size; - if (copy_to_user(tlvd, &header, sizeof(const struct snd_ctl_tlv))) + if (copy_to_user(tlvd, &header, sizeof(struct snd_ctl_tlv))) return -EFAULT; if (copy_to_user(tlvd->tlv, cdata->data, data_size))