Received: by 10.223.185.116 with SMTP id b49csp2210794wrg; Thu, 22 Feb 2018 09:51:19 -0800 (PST) X-Google-Smtp-Source: AH8x225kfUFZhX+98Trks/R4+dT+QZSic8Lw5/AK1O/tdSpc+nOIBrzrRA9dolxaqXyK3XQW2BB0 X-Received: by 2002:a17:902:8349:: with SMTP id z9-v6mr7184938pln.163.1519321879495; Thu, 22 Feb 2018 09:51:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519321879; cv=none; d=google.com; s=arc-20160816; b=ZO0hJ8w2VGO/+5QQIneQZC8kMfL40X2pNdj/yErsyMa9M6qWWvkEFZUvVT5SToGyVR cni6duDD1SwsPH7lvZ6yxKzCHGNYAzvQ+a9bbEc+oBqyuKZn8/1XzAjikja7eh0zRP3K WhMczvGtAJ01GAz+F8z4+fh3s68xJEJSb6hQWI64sPxozZsdRmRVMKHQmMSASbHsoZJf ZGrPZ8KUPLdnJ64e9qH67rnZgEyzmUNd2Lkyd+I+xSz694cb6TaifsDeKTmEIZWuQ7KM 3Wh1YgcKCBSyY72oAAhf5fPsCHWBn3BZkRbqe3/y+S/ktn8atlFTKjA/BW4nCWhT8OA6 XWSg== 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:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=A4/sn8b9bZP4RiLxcfgEW2SidusgiCROTReG3JXqYGU=; b=GNFHs7j+rCw8uF4PTjILA41vM2ZS1yfoE6hGzpOA03z6F8qaNdKFSmUJwwA7uF95bE F9K+UIp5ZSh2t9KYyndi10qXWxapqhIwawh/UOBFQBXOEzfZQ5ZhoZLY33/nsr6PEB8l BQ/kbL4d4MSRg5boiaF3J4zenkJql9ICDWx/SUXv6Wbmys1G2PMJoGzom3j672iKjTmp TIB2f4rMUu8iJg3LlOcZMyXWBLRft8UCkeQaZc1Lv8aAwc5ODyEposG2hNphgW5WjUA9 MAO3vSvBY6/tHwkIZFeO6FGwQCrT02SXAZKXXDn7pD+P52g5+gFvGOvd3sDfVmI3Xo+M psLQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16-v6si376804pll.679.2018.02.22.09.51.05; Thu, 22 Feb 2018 09:51:19 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933621AbeBVRuU (ORCPT + 99 others); Thu, 22 Feb 2018 12:50:20 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:54987 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933441AbeBVRuQ (ORCPT ); Thu, 22 Feb 2018 12:50:16 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eov0X-0003ub-5M; Thu, 22 Feb 2018 17:50:13 +0000 From: Colin King To: Ralf Baechle , James Hogan , linux-mips@linux-mips.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: ath25: check for kzalloc allocation failure Date: Thu, 22 Feb 2018 17:50:12 +0000 Message-Id: <20180222175012.11076-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently there is no null check on a failed allocation of board_data, and hence a null pointer dereference will occurr. Fix this by checking for the out of memory null pointer. Fixes: a7473717483e ("MIPS: ath25: add board configuration detection") Signed-off-by: Colin Ian King --- arch/mips/ath25/board.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/ath25/board.c b/arch/mips/ath25/board.c index 9ab48ff80c1c..6d11ae581ea7 100644 --- a/arch/mips/ath25/board.c +++ b/arch/mips/ath25/board.c @@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size) } board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL); + if (!board_data) + goto error; ath25_board.config = (struct ath25_boarddata *)board_data; memcpy_fromio(board_data, bcfg, 0x100); if (broken_boarddata) { -- 2.15.1