Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283819
b: refs/heads/master
c: 48afc52
h: refs/heads/master
i:
  283817: de8f195
  283815: 055dc30
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 29, 2011
1 parent 975fb91 commit a0fc91e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40216ce7aa88c2e70869723a0f5929fdbd4a91c5
refs/heads/master: 48afc5272eec2e1a7cf17aee0d2949810a45994a
13 changes: 10 additions & 3 deletions trunk/sound/soc/codecs/sigmadsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,25 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)
* purposes and having the limit makes it easier to avoid integer
* overflows later in the loading process.
*/
if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000)
if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) {
dev_err(&client->dev, "Failed to load firmware: Invalid size\n");
goto done;
}

ssfw_head = (void *)fw->data;
if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic)))
if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) {
dev_err(&client->dev, "Failed to load firmware: Invalid magic\n");
goto done;
}

crc = crc32(0, fw->data + sizeof(*ssfw_head),
fw->size - sizeof(*ssfw_head));
pr_debug("%s: crc=%x\n", __func__, crc);
if (crc != le32_to_cpu(ssfw_head->crc))
if (crc != le32_to_cpu(ssfw_head->crc)) {
dev_err(&client->dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n",
le32_to_cpu(ssfw_head->crc), crc);
goto done;
}

ssfw.pos = sizeof(*ssfw_head);

Expand Down

0 comments on commit a0fc91e

Please sign in to comment.