From: Takashi Iwai <tiwai@suse.de>
To: Bard liao <yung-chuan.liao@linux.intel.com>
Cc: daniel.baluta@gmail.com, andriy.shevchenko@intel.com,
alsa-devel@alsa-project.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
liam.r.girdwood@linux.intel.com, vkoul@kernel.org,
broonie@kernel.org, sound-open-firmware@alsa-project.org,
alan@linux.intel.com
Subject: Re: [PATCH v3 09/14] ASoC: SOF: Add firmware, loader support
Date: Thu, 20 Dec 2018 09:16:16 +0100 [thread overview]
Message-ID: <s5h8t0kobov.wl-tiwai@suse.de> (raw)
In-Reply-To: <1ce21393-048f-6c04-b899-8cbfbf93983e@linux.intel.com>
On Thu, 20 Dec 2018 03:11:55 +0100,
Bard liao wrote:
>
>
> > Date: Wed, 12 Dec 2018 12:23:33 +0100
> > From: Takashi Iwai <tiwai@suse.de>
> > To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > Cc: alsa-devel@alsa-project.org, andriy.shevchenko@intel.com, Daniel
> > Baluta <daniel.baluta@gmail.com>, liam.r.girdwood@linux.intel.com,
> > vkoul@kernel.org, broonie@kernel.org, Alan Cox <alan@linux.intel.com>,
> > sound-open-firmware@alsa-project.org
> > Subject: Re: [alsa-devel] [PATCH v3 09/14] ASoC: SOF: Add firmware
> > loader support
> > Message-ID: <s5htvjjj8ei.wl-tiwai@suse.de>
> > Content-Type: text/plain; charset=US-ASCII
> >
> > On Tue, 11 Dec 2018 22:23:13 +0100,
> > Pierre-Louis Bossart wrote:
> >
> >> +
> >> + snd_sof_dsp_block_write(sdev, offset,
> >> + (void *)block + sizeof(*block),
> >> + block->size);
> >> +
> >> + /* next block */
> >> + block = (void *)block + sizeof(*block) + block->size;
> > This may lead to an unaligned access.
>
> Did you mean we should double check the block->size to
> prevent access to an invalid address?
You need two types of checks for the given data:
- The bounce check of block->size;
We need to avoid out-of-bounce access.
- Alignment of block->size;
For some non-x86 platforms, the access to an unaligned address might
be illegal.
Oh, and recently another thing is sometimes needed for avoiding
Spectre. This can be covered by array_index_nospec().
> > Also how is the endianess guaranteed?
>
> Did you mean we should guarantee the driver can work no
> matter what kernel's endianess is?
> ie. Use le32_to_cpu() to handle it?
Depends on the implementation. IIRC, topology API refuses the data
in a different endianess by checking the magic number at beginning.
thanks,
Takashi
next prev parent reply other threads:[~2018-12-20 8:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3934.1544619824.753.alsa-devel@alsa-project.org>
2018-12-20 2:11 ` [PATCH v3 09/14] ASoC: SOF: Add firmware, loader support Bard liao
2018-12-20 8:16 ` Takashi Iwai [this message]
2018-12-20 15:07 ` Pierre-Louis Bossart
2018-12-21 9:05 ` Bard liao
2018-12-21 9:57 ` Takashi Iwai
2018-12-21 15:43 ` Liam Girdwood
2018-12-11 21:23 [PATCH v3 00/14] Sound Open Firmware (SOF) core Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 09/14] ASoC: SOF: Add firmware loader support Pierre-Louis Bossart
2018-12-11 22:38 ` Andy Shevchenko
2018-12-11 23:54 ` Pierre-Louis Bossart
2019-01-09 20:55 ` Mark Brown
2018-12-12 11:23 ` Takashi Iwai
2019-01-09 21:02 ` Mark Brown
2019-01-09 21:24 ` Pierre-Louis Bossart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5h8t0kobov.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alan@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox