From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>,
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>,
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: Fri, 21 Dec 2018 15:43:16 +0000 [thread overview]
Message-ID: <8ce59b64ad855f9b6602318f78b3087f8181fdf2.camel@linux.intel.com> (raw)
In-Reply-To: <s5hfturmcc2.wl-tiwai@suse.de>
On Fri, 2018-12-21 at 10:57 +0100, Takashi Iwai wrote:
> On Fri, 21 Dec 2018 10:05:04 +0100,
> Bard liao wrote:
> >
> > On 12/20/2018 11:07 PM, 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.
> > > s/bounce/bounds ?
> > > > - Alignment of block->size;
> > > > For some non-x86 platforms, the access to an unaligned address might
> > > > be illegal.
> > >
> > > Maybe I am missing something but I don't see any sort of explicit
> > > restriction on alignment in the SOF tools. it looks implicit based
> > > on address offsets and bases.
> >
> > Maybe get_unaligned() is good enough to avoid unaligned access?
>
> That's another option, but you'd need to put everywhere.
>
> An alternative is to just copy the data on a new block header on the
> stack temporarily and refer it.
>
> Or simply assuring the alignment by checking block->size as Pierre
> suggested...
Yep, checking size is good for me too.
>
>
> Takashi
>
>
> > > Liam, do you see any negative side effects if we enforce a 32-bit
> > > alignment for all blocks (which essentially means all block sizes
> > > are multiple of 4)? we can try and experiment but it's better if we
> > > have an agreement on the design.
This shouldn't cause any problems, iirc all block sizes are rounded up to
nearest uint32_t anyway (as we have exception handler blocks that are 3 bytes of
assembly in size and rounded up to 4).
Liam
> > >
> > >
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2018-12-21 15:43 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
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 [this message]
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=8ce59b64ad855f9b6602318f78b3087f8181fdf2.camel@linux.intel.com \
--to=liam.r.girdwood@linux.intel.com \
--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=pierre-louis.bossart@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.de \
--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