Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/0 day warnings #54

Merged
merged 2 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sound/soc/sof/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion sound/soc/sof/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down