From: Naveen Krishna Chatradhi Subject: [PATCH 7/9 v6] crypto:s5p-sss: validate iv before memcpy Date: Fri, 07 Feb 2014 10:55:27 +0530 Message-ID: <1391750727-27496-1-git-send-email-ch.naveen@samsung.com> References: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> Cc: linux-kernel@vger.kernel.org, vzapolskiy@gmail.com, herbert@gondor.apana.org.au, naveenkrishna.ch@gmail.com, cpgs@samsung.com To: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org Return-path: Received: from mailout4.samsung.com ([203.254.224.34]:24373 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbaBGFZp (ORCPT ); Fri, 7 Feb 2014 00:25:45 -0500 In-reply-to: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: This patch adds code to validate "iv" buffer before trying to memcpy the contents Signed-off-by: Naveen Krishna Chatradhi Reviewed-by: Tomasz Figa --- changes since v5: None drivers/crypto/s5p-sss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index da1c8943..a890273 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); -- 1.7.9.5