[alsa-devel] [PATCH] ASoC: Intel: Skylake: Add DSP firmware manifest parsing

Mark Brown broonie at kernel.org
Tue Apr 12 06:12:07 CEST 2016


On Sun, Apr 03, 2016 at 03:19:14AM +0530, Vinod Koul wrote:

> +	for (i = 0; i < num; i++) {
> +		if (!strcmp(uuid, tbl[i].uuid)) {

Do we really want to be working with UUIDs in string format all the
time?  It seems error prone and as far as I can see at least some of the
time we get them in in binary format.

> +	sprintf(buf, "%08X", entry->uuid.id_1);
> +	sprintf(buf+strlen(buf), "-");

Coding style, spaces around +.  I'd also like to be a bit more confident
that this can't result in a buffer overflow, sprintf() isn't reassuring
especially in conjunction with buf being passed in from elsewhere with
no length information.

> +	adsp_hdr = (struct adsp_fw_hdr *)(buf + SKL_ADSP_FW_BIN_HDR_OFFSET);
> +
> +	mod_entry = (struct adsp_module_entry *)
> +		(buf + SKL_ADSP_FW_BIN_HDR_OFFSET + adsp_hdr->header_len);
> +
> +	num_entry = adsp_hdr->num_module_entries;

> +	for (i = 0; i < num_entry; i++, mod_entry++) {
> +		get_canonical_uuid(uuid_str, mod_entry);

We're not checking that we're not walking off the end of the file here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160412/d9b84115/attachment.sig>


More information about the Alsa-devel mailing list