summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/s5p-sss.c
diff options
context:
space:
mode:
authorNaveen Krishna Chatradhi <ch.naveen@samsung.com>2014-05-08 15:58:15 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2014-05-08 15:58:15 +0200
commit8f9702aad13892cc50560f29adfa313da584636b (patch)
tree8bfbf7002d6d08497c0f785d2a2943139898d967 /drivers/crypto/s5p-sss.c
parentcrypto: s5p-sss - Let Exynos SoCs select SSS driver (diff)
downloadlinux-8f9702aad13892cc50560f29adfa313da584636b.tar.xz
linux-8f9702aad13892cc50560f29adfa313da584636b.zip
crypto: s5p-sss - validate iv before memcpy
This patch adds code to validate "iv" buffer before trying to memcpy the contents Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> CC: David S. Miller <davem@davemloft.net> CC: <linux-samsung-soc@vger.kernel.org> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/s5p-sss.c')
-rw-r--r--drivers/crypto/s5p-sss.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 37e0598a8cba..0ffc0429d16d 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -380,7 +380,8 @@ static void s5p_set_aes(struct s5p_aes_dev *dev,
{
void __iomem *keystart;
- memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), iv, 0x10);
+ if (iv)
+ memcpy(dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), iv, 0x10);
if (keylen == AES_KEYSIZE_256)
keystart = dev->aes_ioaddr + SSS_REG_AES_KEY_DATA(0);