Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5444340ybn; Sat, 28 Sep 2019 21:48:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKdzVZH42HcHxOxT3oFs2boxNAM4JgDIs0/aFtdc1HKUk9ShLdeG/oIJCG8frzI//4CSpT X-Received: by 2002:a50:95a3:: with SMTP id w32mr12906594eda.211.1569732524209; Sat, 28 Sep 2019 21:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569732524; cv=none; d=google.com; s=arc-20160816; b=hruLwtCZ3B1iddGc9O3FSBPPs6Tcf78UlicHfVMTkht6NI/S3SqbXTHY/h2YXPXqaj S6BsXmQQZdCXwB38gY4ZMsGvPX3WUBc+bKigdz0w+6YfXgr3bsTZWzdrjOeYFbUir7zI h1vKte6GxGvafPYVZXCSE96BsM2hOlN1FaEl6HmZYlNZb2dCqwAguVgED/Vmo0Kz0juS sYFdJ8FiIYwbcE40hhaoyS58szDV1OLo0g/M96Clw8haENXo5A3lXh1OxiYjOWYhpmO3 UjVZ/D2zvc7Bz2kgFtjLqYyG7mYoh9WTbcNsDw/v8eetGJ+Sh/2U5fYcHcqDpatsbDfy 4jqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=iEMm/hQnYvIBqebms+HPBrsyt5aCDuzCWL1bJs/kS4o=; b=XoRGImiP26OaH/0ukvUUU5BkMA43sSiHBPPBBphBrJ6o0SSEVZw9F2kXMkrfIwA6XI szD32QS+U5ZHQR/sMmBScLqSkMMaBH+EhayWwhSYfc8u5mWm3kiErv3E3VGlG3fRRz7E VDcxgJtvMGgftqf0tQ6Jm/7Da0vXi521/YcJOVop5Ls52bvL2qitMKmfyh6l0yarZoov DMSC1Iun4l68T1/X6gmK05XN8fx0BmnI+wpHr58oOY5hBRsEJLe45+3XgUZliAi0dWw1 R/zEgFTGShbfxYWuOa1COTlUSXFsdUiI4rHq6a2sGuuDFafNVsBHYAegbMZN3dk7RNOT h/6A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si5189441ejq.45.2019.09.28.21.48.19; Sat, 28 Sep 2019 21:48:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726928AbfI2EoZ (ORCPT + 99 others); Sun, 29 Sep 2019 00:44:25 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39902 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725924AbfI2EoZ (ORCPT ); Sun, 29 Sep 2019 00:44:25 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6EFA09C8C5F91C21757A; Sun, 29 Sep 2019 12:44:22 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Sun, 29 Sep 2019 12:44:20 +0800 To: , , , , , CC: , From: Yunfeng Ye Subject: [PATCH] arm64: armv8_deprecated: Checking return value for memory allocation Message-ID: Date: Sun, 29 Sep 2019 12:44:17 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no return value checking when using kzalloc() and kcalloc() for memory allocation. so add it. Signed-off-by: Yunfeng Ye --- arch/arm64/kernel/armv8_deprecated.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index 2ec09de..ca158be 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -174,6 +174,9 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops) struct insn_emulation *insn; insn = kzalloc(sizeof(*insn), GFP_KERNEL); + if (!insn) + return; + insn->ops = ops; insn->min = INSN_UNDEF; @@ -233,6 +236,8 @@ static void __init register_insn_emulation_sysctl(void) insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl), GFP_KERNEL); + if (!insns_sysctl) + return; raw_spin_lock_irqsave(&insn_emulation_lock, flags); list_for_each_entry(insn, &insn_emulation, node) { -- 2.7.4