From: "Rojewski, Cezary" <cezary.rojewski@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "pierre-louis.bossart@linux.intel.com"
<pierre-louis.bossart@linux.intel.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"Kaczmarski, Filip" <filip.kaczmarski@intel.com>,
"N, Harshapriya" <harshapriya.n@intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"Barlik, Marcin" <marcin.barlik@intel.com>,
"zwisler@google.com" <zwisler@google.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"tiwai@suse.com" <tiwai@suse.com>,
"Proborszcz, Filip" <filip.proborszcz@intel.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"amadeuszx.slawinski@linux.intel.com"
<amadeuszx.slawinski@linux.intel.com>,
"Wasko, Michal" <michal.wasko@intel.com>,
"cujomalainey@chromium.org" <cujomalainey@chromium.org>,
"Hejmowski, Krzysztof" <krzysztof.hejmowski@intel.com>,
"Papierkowski, Piotr \(Habana\)" <ppapierkowski@habana.ai>,
"Gopal, Vamshi Krishna" <vamshi.krishna.gopal@intel.com>
Subject: RE: [PATCH v7 03/14] ASoC: Intel: catpt: Add IPC message handlers
Date: Tue, 22 Sep 2020 11:04:31 +0000 [thread overview]
Message-ID: <4e51e628f9df457c8253a3ef6d7095eb@intel.com> (raw)
In-Reply-To: <20200922090442.GJ3956970@smile.fi.intel.com>
On 2020-09-22 11:04 AM, Andy Shevchenko wrote:
> On Mon, Sep 21, 2020 at 08:48:12PM +0000, Rojewski, Cezary wrote:
>> On 2020-09-21 8:41 PM, Andy Shevchenko wrote:
...
>> While this should never happen (means user is somehow not making use of
>> officially released firmware binary), coredumps are useful only if you
>> have access to debug tools. In cases you'd mentioned, invalid hash would
>> have been dumped to coredump and crash reader simply wouldn't have been
>> able to navigate to actual build for it. The rest of the coredump is still
>> vital though.
>>
>> memcpy() could be gated behind an 'if' for safety if needed:
>>
>> info = cdev->ipc.config.fw_info;
>> eof = info + FW_INFO_SIZE_MAX;
>> /* navigate to fifth info segment (fw hash) */
>> for (i = 0; i < 4 && info < eof; i++, info++)
>> /* info segments are separated by space each */
>> if ((info = strnchr(info, eof - info, ' ')) == NULL)
>> break;
>
>> if (i == 4 && info < eof)
>> memcpy(pos, info, min(eof - info, CATPT_DUMP_HASH_SIZE));
>
> And here basically enough check is info against NULL, right?
> Just try to look at different possibilities how to make code simpler and neater.
>
>> Didn't compile this, some typecheck fixes might be in order and so on.
>
What you meant is:
if (i == 4 && !info) // instead of 'info < eof'
right?
If 4th space is last char in this string then info would end up being
non-NULL and equal to 'eof' and thus memcpy() would get invoked with
size=eof-info=0.
catpt_coredump() is here to gather debug info for Intel folks to analyze
in case of critical error. In ideal world, it should not be required at
all as when we get here, there are bigger problems on our head.
Above solution is simpler than what is prevent in v7 while also
maintaining good readability - variable names - plus comments which you
suggested.
Czarek
next prev parent reply other threads:[~2020-09-22 11:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 11:54 [PATCH v7 00/14] ASoC: Intel: Catpt - Lynx and Wildcat point Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 01/14] ASoC: Intel: Add catpt base members Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 02/14] ASoC: Intel: catpt: Implement IPC protocol Cezary Rojewski
2020-09-21 13:00 ` Andy Shevchenko
2020-09-21 17:57 ` Rojewski, Cezary
2020-09-21 11:54 ` [PATCH v7 03/14] ASoC: Intel: catpt: Add IPC message handlers Cezary Rojewski
2020-09-21 12:59 ` Andy Shevchenko
2020-09-21 13:58 ` Amadeusz Sławiński
2020-09-21 14:20 ` Andy Shevchenko
2020-09-21 14:23 ` Andy Shevchenko
2020-09-21 18:14 ` Rojewski, Cezary
2020-09-21 18:13 ` Rojewski, Cezary
2020-09-21 18:41 ` Andy Shevchenko
2020-09-21 20:48 ` Rojewski, Cezary
2020-09-22 9:04 ` Andy Shevchenko
2020-09-22 11:04 ` Rojewski, Cezary [this message]
2020-09-22 11:29 ` Andy Shevchenko
2020-09-22 11:30 ` Andy Shevchenko
2020-09-22 11:56 ` Rojewski, Cezary
2020-09-21 11:54 ` [PATCH v7 04/14] ASoC: Intel: catpt: Define DSP operations Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 05/14] ASoC: Intel: catpt: Firmware loading and context restore Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 06/14] ASoC: Intel: catpt: PCM operations Cezary Rojewski
2020-09-21 14:08 ` Andy Shevchenko
2020-09-21 18:50 ` Rojewski, Cezary
2020-09-21 11:54 ` [PATCH v7 07/14] ASoC: Intel: catpt: Device driver lifecycle Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 08/14] ASoC: Intel: catpt: Event tracing Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 09/14] ASoC: Intel: catpt: Simple sysfs attributes Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 10/14] ASoC: Intel: haswell: Remove haswell-solution specific code Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 11/14] ASoC: Intel: broadwell: " Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 12/14] ASoC: Intel: bdw-5650: " Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 13/14] ASoC: Intel: bdw-5677: " Cezary Rojewski
2020-09-21 11:54 ` [PATCH v7 14/14] ASoC: Intel: Select catpt and deprecate haswell 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=4e51e628f9df457c8253a3ef6d7095eb@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cujomalainey@chromium.org \
--cc=filip.kaczmarski@intel.com \
--cc=filip.proborszcz@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=harshapriya.n@intel.com \
--cc=krzysztof.hejmowski@intel.com \
--cc=lgirdwood@gmail.com \
--cc=marcin.barlik@intel.com \
--cc=michal.wasko@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ppapierkowski@habana.ai \
--cc=tiwai@suse.com \
--cc=vamshi.krishna.gopal@intel.com \
--cc=zwisler@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.