diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index 0e0f928c10c321..5effaea6fe5f97 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -169,7 +169,7 @@ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, SOF_CTRL_TYPE_DATA_GET, scontrol->cmd); size = data->size + sizeof(*data); if (size > be->max) { - dev_err(sdev->dev, "error: DSP sent %ld bytes max is %d\n", + dev_err(sdev->dev, "error: DSP sent %zu bytes max is %d\n", size, be->max); ret = -EINVAL; goto out; diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c index 04acd78f13be1a..1b3797067d6452 100644 --- a/sound/soc/sof/trace.c +++ b/sound/soc/sof/trace.c @@ -73,6 +73,7 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer, unsigned long rem; loff_t lpos = *ppos; size_t avail, buffer_size = dfse->size; + u64 lpos_64; /* make sure we know about any failures on the DSP side */ sdev->dtrace_error = false; @@ -84,7 +85,9 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer, return 0; /* check for buffer wrap and count overflow */ - lpos = lpos % buffer_size; + lpos_64 = lpos; + lpos = do_div(lpos_64, buffer_size); + if (count > buffer_size - lpos) count = buffer_size - lpos;