summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sof/loader.c')
-rw-r--r--sound/soc/sof/loader.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 628fae552442..952a19091c58 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -19,15 +19,13 @@ static int get_ext_windows(struct snd_sof_dev *sdev,
{
struct sof_ipc_window *w =
container_of(ext_hdr, struct sof_ipc_window, ext_hdr);
- size_t size;
if (w->num_windows == 0 || w->num_windows > SOF_IPC_MAX_ELEMS)
return -EINVAL;
- size = sizeof(*w) + sizeof(struct sof_ipc_window_elem) * w->num_windows;
-
/* keep a local copy of the data */
- sdev->info_window = kmemdup(w, size, GFP_KERNEL);
+ sdev->info_window = kmemdup(w, struct_size(w, window, w->num_windows),
+ GFP_KERNEL);
if (!sdev->info_window)
return -ENOMEM;
@@ -337,11 +335,11 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
init_waitqueue_head(&sdev->boot_wait);
sdev->boot_complete = false;
- /* create fw_version debugfs to store boot version info */
+ /* create read-only fw_version debugfs to store boot version info */
if (sdev->first_boot) {
ret = snd_sof_debugfs_buf_item(sdev, &sdev->fw_version,
sizeof(sdev->fw_version),
- "fw_version");
+ "fw_version", 0444);
/* errors are only due to memory allocation, not debugfs */
if (ret < 0) {
dev_err(sdev->dev, "error: snd_sof_debugfs_buf_item failed\n");