From a0fc91ef65e242a2528775ad3867c2c8f4483028 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 09:44:18 +0100 Subject: [PATCH] --- yaml --- r: 283819 b: refs/heads/master c: 48afc5272eec2e1a7cf17aee0d2949810a45994a h: refs/heads/master i: 283817: de8f195952df457b5f178503de2555b572be0f11 283815: 055dc307f5311bc87b4980e72a3f5d68df76ace1 v: v3 --- [refs] | 2 +- trunk/sound/soc/codecs/sigmadsp.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 5e283e9206ab..46b863dcd255 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 40216ce7aa88c2e70869723a0f5929fdbd4a91c5 +refs/heads/master: 48afc5272eec2e1a7cf17aee0d2949810a45994a diff --git a/trunk/sound/soc/codecs/sigmadsp.c b/trunk/sound/soc/codecs/sigmadsp.c index acb97a9834aa..c0ad88516f30 100644 --- a/trunk/sound/soc/codecs/sigmadsp.c +++ b/trunk/sound/soc/codecs/sigmadsp.c @@ -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);