From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: broonie@kernel.org, tiwai@suse.com, perex@perex.cz,
amade@asmblr.net, linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/6] ASoC: Intel: catpt: Fix offset checks
Date: Tue, 25 Nov 2025 20:24:31 +0200 [thread overview]
Message-ID: <aSX0X3NbT6mMzMAL@smile.fi.intel.com> (raw)
In-Reply-To: <0be0219c-51f3-41f1-892a-45a6e5db6bc3@intel.com>
On Tue, Nov 25, 2025 at 12:31:04PM +0100, Cezary Rojewski wrote:
> On 2025-11-24 8:06 PM, Andy Shevchenko wrote:
> > On Mon, Nov 24, 2025 at 09:05:06PM +0200, Andy Shevchenko wrote:
> > > On Mon, Nov 24, 2025 at 07:20:48PM +0100, Cezary Rojewski wrote:
> > > > On 2025-11-24 3:31 PM, Andy Shevchenko wrote:
> > > > > On Fri, Nov 21, 2025 at 12:43:26PM +0100, Cezary Rojewski wrote:
...
> > > > > > static int catpt_restore_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
> > > > >
> > > > > > off = catpt_to_host_offset(info->offset);
> > > > > > - if (off < cdev->dram.start || off > cdev->dram.end)
> > > > > > + if (off < cdev->dram.start || off + info->size >= cdev->dram.end)
> > > > > > continue;
> > > > >
> > > > > Hmm... I would rather do something like
> >
> > > > > struct resource r;
> >
> > You might need to nullify this as well:
> >
> > struct resource r = {}; // or any equivalent
>
> This made me realize variables 'r1', 'r2' and 'common' that are part of
> catpt_restore_fwimage() are not zeroed and utilizing resource_xxx() API
> without doing so is bogus. My plan is to the following: leave this very fix
> as-is (without refactoring) and follow it up immediately with patch that
> swaps manual manipulation with resource_xxx(), as you suggested.
>
> Sounds good?
Yep! Thanks.
> > > > > ...
> > > > > resource_set_range(catpt_to_host_offset(info->offset), info->size);
> > > > > if (!resource_contains())
> > > > > continue;
> > > > >
> > > > > > dev_dbg(cdev->dev, "restoring memdump: off 0x%08x size %d\n",
> > > > >
> > > > > OTOH it seems more invasive change for kinda a fix.
> > > >
> > > > Looks elegant though. My idea was to avoid additional operations (which
> > > > resource_contains() does), perhaps unnecessarily as readability suffered
> > > > because of that. Ack.
> > >
> > > Note, it's defined as static inline, if compiler can prove constiness of
> > > something, it will eliminate the code. TL;DR: let compiler to do its job.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-25 18:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 11:43 [PATCH 0/6] ASoC: Intel: catpt: Round of fixes and PM changes Cezary Rojewski
2025-11-21 11:43 ` [PATCH 1/6] ASoC: Intel: catpt: Fix offset checks Cezary Rojewski
2025-11-24 14:31 ` Andy Shevchenko
2025-11-24 18:20 ` Cezary Rojewski
2025-11-24 19:05 ` Andy Shevchenko
2025-11-24 19:06 ` Andy Shevchenko
2025-11-25 11:31 ` Cezary Rojewski
2025-11-25 18:24 ` Andy Shevchenko [this message]
2025-11-25 18:26 ` Andy Shevchenko
2025-11-21 11:43 ` [PATCH 2/6] ASoC: Intel: catpt: Fix error path in hw_params() Cezary Rojewski
2025-11-21 11:43 ` [PATCH 3/6] ASoC: Intel: catpt: Fix probing order of driver components Cezary Rojewski
2025-11-21 11:43 ` [PATCH 4/6] ASoC: Intel: catpt: Do not ignore errors on runtime resume Cezary Rojewski
2025-11-21 11:43 ` [PATCH 5/6] ASoC: Intel: catpt: Do not block the system from suspending Cezary Rojewski
2025-11-24 14:42 ` Andy Shevchenko
2025-11-24 18:05 ` Cezary Rojewski
2025-11-24 19:07 ` Andy Shevchenko
2025-11-21 11:43 ` [PATCH 6/6] ASoC: Intel: catpt: Drop catpt_runtime_resume() Cezary Rojewski
2025-11-24 14:37 ` Andy Shevchenko
2025-11-24 18:06 ` Cezary Rojewski
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=aSX0X3NbT6mMzMAL@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.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