Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756638AbaAJLpL (ORCPT ); Fri, 10 Jan 2014 06:45:11 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:44618 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbaAJLpF (ORCPT ); Fri, 10 Jan 2014 06:45:05 -0500 X-AuditID: cbfee690-b7f266d00000287c-3a-52cfdd40ddf0 From: Naveen Krishna Chatradhi To: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, vzapolskiy@gmail.com, herbert@gondor.apana.org.au, naveenkrishna.ch@gmail.com, cpgs@samsung.com, tomasz.figa@gmail.com Subject: [PATCH 7/8 v3] crypto:s5p-sss: validate iv before memcpy Date: Fri, 10 Jan 2014 17:15:21 +0530 Message-id: <1389354321-32096-1-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> References: <1389243640-13282-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsWyRsSkRtfh7vkgg9mHDC1eHtK06H4lY3H/ 3k8mi8u75rBZzDi/j8li0bb/zBardv1htDg75xCTA4fHzll32T22HVD16NuyitHj8ya5AJYo LpuU1JzMstQifbsEroz/WxqZCy6wVTz49pipgXEraxcjJ4eEgInE9/X7GCFsMYkL99azdTFy cQgJLGWUWL5yEnMXIwdY0eWF1hDx6YwSq7f9YYJw+pkkTrbMBpvEJmAmcXDRanYQW0TAWeJ3 8xpWkCJmgTmMEg+XtLOATBIWcJRoblIAMVkEVCVWv1MDKecVcJW4+KqLDWKXgsScSTYgYU4B N4mtl5+ATRQCKplz4iozyEQJgXnsEou2vWUGSbAICEh8m3yIBaJXVmLTAWaIXyQlDq64wTKB UXgBI8MqRtHUguSC4qT0IhO94sTc4tK8dL3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8jvFlf29PrmKt9VpjfkjXZ+krz3x6703uXHk7KW8Pu9iJ1tJ/i5 6GbVNkvGDZ9lr0pps7lX8f69V8TSnrDtqNTHTxf+vY1nEFViKc5INNRiLipOBADLxUck4QIA AA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds code to validate "iv" buffer before trying to memcpy the contents Signed-off-by: Naveen Krishna Chatradhi --- Changes since v2: None drivers/crypto/s5p-sss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index f274f5f..7058bb6 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -381,8 +381,9 @@ static void s5p_set_aes(struct s5p_aes_dev *dev, struct samsung_aes_variant *var = dev->variant; void __iomem *keystart; - memcpy(dev->ioaddr + SSS_REG_AES_IV_DATA - (var->aes_offset, 0), iv, 0x10); + if (iv) + memcpy(dev->ioaddr + SSS_REG_AES_IV_DATA + (var->aes_offset, 0), iv, 0x10); if (keylen == AES_KEYSIZE_256) keystart = dev->ioaddr + -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/