Received: by 10.192.165.148 with SMTP id m20csp4907049imm; Tue, 8 May 2018 17:14:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpaXorRgKuTyhGweL20y9vHlytWYfHVa8FmHPg1GqOb3RxcgbD8VFhodP2T5EdZtn+jWoch X-Received: by 2002:a63:3fc9:: with SMTP id m192-v6mr3617088pga.340.1525824841639; Tue, 08 May 2018 17:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525824841; cv=none; d=google.com; s=arc-20160816; b=WmGY95AjK3bSS1pgbY7R1+iShXGBUSO2EFgjtlxT4TUhL58EJg3lbnNf+m2ofJPssK pgdp9qogBnih5ZJzOHl9VhhcAsBSDWY/NmnjaaVmi9iu5nvrE3/Umt+qNfryLIXnuM8P tIe7ReUKVRIaKAg/m3WPDV+429W+3r5nU9/mmBXtQPLoQ1ncu53qgDUATXPRFTgkA6P1 NLKZa+nCZWQ8aYvd8ASaeYM1LKboJdROO3HETq798rIH/pCFkbjp+hDtq7sygElGXxtZ 6sPkoHACFaFIQNdZl21CUlGFq2DFYgmP/HuqyG8W7WJvrxVQeTRkZ7dITkxi74LLytR9 l+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=WIIHrpnS9oI1xRXarDT9WU//sCuak4nTuRno49RDHL4=; b=y70htFIinReTsuIunKcP9MNDxbCXWYPZMHLgYs27v7heuhLbu/zLH89nAskCuRSEn8 ul/PVY3VRRauqLAPzh5Qx3XZbUsh9xdDM6YdWZeepc3t+ox/THNh2Cv9R7xmv9w9SjX/ 3CVTiUCGsfRa9YADPxu/K39jBGgOfFyDzZBbD6MVEm3h4FaVCi36x//MJJgOHVotVFv6 lsUxJVh6K5Ptq2233nmSvxv5Z5VEix9n7XcT+6/hiQu0/4Uuk1CKZWnXGNufWr/7AU9T vaYa+DVlowmP2B/HLhGzMXhKdK5B797XXp1/GxCkXK9KCuwVhVVgRNycxzdRCoWaOX8C rmOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=c09WIxmU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z24-v6si20497537pge.161.2018.05.08.17.13.41; Tue, 08 May 2018 17:14:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=c09WIxmU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933134AbeEIANF (ORCPT + 99 others); Tue, 8 May 2018 20:13:05 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:35863 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932475AbeEIANC (ORCPT ); Tue, 8 May 2018 20:13:02 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180509001259epoutp032dedef6f8922ca3be14601141bf93b9d~s0Y2UZSgc2679926799epoutp03d; Wed, 9 May 2018 00:12:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180509001259epoutp032dedef6f8922ca3be14601141bf93b9d~s0Y2UZSgc2679926799epoutp03d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1525824779; bh=WIIHrpnS9oI1xRXarDT9WU//sCuak4nTuRno49RDHL4=; h=From:To:Cc:Subject:Date:References:From; b=c09WIxmUpRxdvJinL3zHZhAFUjJqRmXwjKINlXjaWpT1YM+X1v/U/MTObsJaa4cgC 8uKDYbXIhYerLVsERcDvJpRN26nIooZLZA9X55UZrOXnOyLvTNNpF12HskGp0Uzx2P 4pvTmyivqiAeQF7PK+JUMn8vjNhL9lTUmLcR0ZtM= Received: from epsmges1p3.samsung.com (unknown [182.195.40.164]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180509001258epcas1p1de68ba7331295c0b3c49e8a77a46e316~s0Y1Go6oN2220322203epcas1p1e; Wed, 9 May 2018 00:12:58 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id B7.F3.04144.A0D32FA5; Wed, 9 May 2018 09:12:58 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180509001258epcas1p4e8db163d8babd90284dd6afb6a96eb0f~s0Y0sKSEi1534715347epcas1p4V; Wed, 9 May 2018 00:12:58 +0000 (GMT) X-AuditID: b6c32a37-511ff70000001030-ff-5af23d0a3908 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 8F.A1.03822.90D32FA5; Wed, 9 May 2018 09:12:57 +0900 (KST) Received: from localhost.localdomain ([10.253.107.61]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P8F008EBPX9TR40@mmp2.samsung.com>; Wed, 09 May 2018 09:12:57 +0900 (KST) From: Ji-Hun Kim To: peterhuewe@gmx.de, tweek@google.com Cc: jarkko.sakkinen@linux.intel.com, jgg@ziepe.ca, arnd@arndb.de, gregkh@linuxfoundation.org, javierm@redhat.com, sonnyrao@chromium.org, ji_hun.kim@samsung.com, enric.balletbo@collabora.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup() Date: Wed, 09 May 2018 09:12:36 +0900 Message-id: <1525824757-21835-1-git-send-email-ji_hun.kim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMKsWRmVeSWpSXmKPExsWy7bCmgS6X7acogxsHpC3+TjrGbrHm9iFG i+bF69ksvq9ysVg4bTmjxcwZJxgt+k9vZ7TYekva4sQ5oKrLu+awWbzd95Pd4smZmYwW8371 Mjnwevz+NYnRY3bDRRaPHXeXMHp8+BjnsWBTqce8k4Ee++euYfd4v+8qm0ffllWMHp83yXls /XybJYA7KtUmIzUxJbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0z B+h6JYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmtUrShoZGeoYG5npERkDaPtTIyBSpJSM2Y 82ARa0EPe8Wvl5MZGxj/s3YxcnJICJhI3N4+k62LkYtDSGAHo8TMk3dYIJzvjBIday+yw1T1 L+pihUhsYJSY0LgMquUHo8SzpXvBZrEJaEps7L7GCGKLCKhLTJh8kgmkiFlgKZPEhiNn2UAS wgKuEi8PdoGNZRFQlfi18yMziM0r4Cax9u4yqHVyEiePTQZbJyFwgE3idf9+RoiEi8Tpbbug LheWeHV8C1ADB5AtLXHpqC1EuFpiwZUdLBB2jcTN/0uZIGxjid6eC2C7mAX4JN597WGFaOWV 6GgTgijxkHix+CXUCY4SOy+sAGsVEoiV2H24mWkCo+QCRoZVjGKpBcW56anFhgXGesWJucWl eel6yfm5mxjBCUrLfAfjhnM+hxgFOBiVeHgldn6MEmJNLCuuzD3EKMHBrCTCK2v8KUqINyWx siq1KD++qDQntfgQoykwNCYyS4km5wOTZ15JvKGpkb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163d8babd90284dd6afb6a96eb0f X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180509001258epcas1p4e8db163d8babd90284dd6afb6a96eb0f X-RootMTR: 20180509001258epcas1p4e8db163d8babd90284dd6afb6a96eb0f References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kmemdup rather than duplicating its implementation. Signed-off-by: Ji-Hun Kim --- drivers/char/tpm/eventlog/of.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/char/tpm/eventlog/of.c b/drivers/char/tpm/eventlog/of.c index b7cac47..bba5fba 100644 --- a/drivers/char/tpm/eventlog/of.c +++ b/drivers/char/tpm/eventlog/of.c @@ -69,14 +69,12 @@ int tpm_read_log_of(struct tpm_chip *chip) return -EIO; } - log->bios_event_log = kmalloc(size, GFP_KERNEL); + log->bios_event_log = kmemdup(__va(base), size, GFP_KERNEL); if (!log->bios_event_log) return -ENOMEM; log->bios_event_log_end = log->bios_event_log + size; - memcpy(log->bios_event_log, __va(base), size); - if (chip->flags & TPM_CHIP_FLAG_TPM2) return EFI_TCG2_EVENT_LOG_FORMAT_TCG_2; return EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2; -- 1.9.1