Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp508740ybe; Fri, 6 Sep 2019 03:00:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNWvNEeQTNgYsSDLLd+iVXIpZYf9GBCTOnEniIZLlymi4ScpKOBvg0IsWHTD75r2NV1sqT X-Received: by 2002:a63:ea14:: with SMTP id c20mr7052586pgi.185.1567764004333; Fri, 06 Sep 2019 03:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567764004; cv=none; d=google.com; s=arc-20160816; b=yjtRpW6PiPcJRY2hc8/kmBKul/M1J6XAojMU6AZYPooa/x6F0Nleu2k6OKXLwyEA3p cbhnRcktzcdgmvQWbbo3PgIudycSwKlUFezn9eJetbODbGljWvVILszQlyVd5CP/1R56 ycyo6S0JppfjrsWQpLxkiCXtjuRyJ77fzlecgjvWKrKIIahFy8VwsZyTkzJHLsF2Ls0D sM+Q/F1dM+C29y92iUDua16WYDcQ0zepQVucy+Wn/dWO92itCem3DnDZDucYZk/uIN3G 3uBt5igtYxpay1XDX2RMS3ULcT2uL18nY+o2o619sbTqlIFDZwgu5XRfq84xfOR+GjgC 6ZCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=jtjFrbgie1B8vmotFZj58YoVLg9kCTIeE4Vs+aG5yy8=; b=shxLv+fwwhHnx2hQDQLguSp2bt8fzoRvDyUT+4v1M2jQ9/2bEdCS9/tdlYXSto4ydI qufbqaYyEISK+kFCB2Co0dP5ubCdwEjvnmlhOX195/vlT/wu8c0txzreMvvBKvdfHaEY kekElwSPf6dCCqizo8aCKqJTja0kfVMydh2R3fZ7r62TQGMD5Xu36unNEYY3BwH18PAH 72DpW6WJyfNtpwlxnrTwvGuPHZqUa3Rl2ks7zYaF5T5rI057iDSmFsDCbAPgjojRjymp u09sJQZw/shQbGOIPaRt8HkuVNNph/Uem29WCgbWGabm1CJbT2y+axlNPwNJZEeQ5YE9 CLPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GjvkBbhe; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b62si3964349pgc.148.2019.09.06.02.59.47; Fri, 06 Sep 2019 03:00:04 -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=@gmail.com header.s=20161025 header.b=GjvkBbhe; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388596AbfIEX37 (ORCPT + 99 others); Thu, 5 Sep 2019 19:29:59 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35018 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732754AbfIEX36 (ORCPT ); Thu, 5 Sep 2019 19:29:58 -0400 Received: by mail-pf1-f193.google.com with SMTP id 205so2958327pfw.2; Thu, 05 Sep 2019 16:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=jtjFrbgie1B8vmotFZj58YoVLg9kCTIeE4Vs+aG5yy8=; b=GjvkBbheJ20Oy02sUV3saiUzVXZKKF1U3bWFaz0/bwYzSt5iLGyB5m54e4TlykmKzo 9R+kTu2YK/dX8keMqxuC4k0rLU5EuyoWwd+CzHbi63GuS0IYBRZ7+TQ2BrieCyKMSjvh WPXo/Byln+FM4SQ70G1sW0jEK1/MTSCmBhYbqh7qdJBGxc0/8O38ZGbuI7heP/utaxKI Cz2flVZ0QavcT5olP8BXIBg8uj9iUMaPVy639ZwnYj+1YYhKFuhCUEML3tTJFnf3iaQL bGJIevkUPwyjxW/qGiWEVldVj2KL+ZLPNDOdMsT872DnDJsFHQBDMhZjPm4nW65VUCyv ek4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=jtjFrbgie1B8vmotFZj58YoVLg9kCTIeE4Vs+aG5yy8=; b=U7KfonW/qKcw3T8tJDK49byclLmKf3lQ1K4e6sgNFWG38zJWaF/oHYtQk9uSVNVz6x lBiDd5C9kBa3qVPWkbOYy12CVGVqk1QG6KyERu6r8UlZNtj+unW1/ByznpLRq8KH0fSc hw9ZZo6CI5UorkMr07/yD5egLNc876yh/TDB8ENVhS8UYsu0TpY8PvEZirZf7ifO22x/ zHVPJsUj3pUNg1FKe9hAC+rpZ0D/De6qCoKetrh4G0K2UIVYT7zIrF70Zup43J1tTkxD R785X+4jF/y5tMUmvlUn8K0UDyvG5AEe+g3g+fF++FhYKtn3HlygXf9cNOeoO5IYoJvr l6Qg== X-Gm-Message-State: APjAAAWqxg7jSCqc+NWtk/PJ2MNt7WoOyZVT2r5aOJl8N+Ceb980B/fU jsSxVt7CJzz0CDyq/XfDWu0= X-Received: by 2002:a17:90a:6302:: with SMTP id e2mr6578753pjj.34.1567726197490; Thu, 05 Sep 2019 16:29:57 -0700 (PDT) Received: from LGEARND20B15 ([27.122.242.75]) by smtp.gmail.com with ESMTPSA id v27sm8198814pgn.76.2019.09.05.16.29.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Sep 2019 16:29:57 -0700 (PDT) Date: Fri, 6 Sep 2019 08:29:51 +0900 From: Austin Kim To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org Cc: dvhart@infradead.org, andy@infradead.org, hpa@zytor.com, x86@kernel.org, gregkh@linuxfoundation.org, allison@lohutok.net, armijn@tjaldur.nl, kjlu@umn.edu, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/platform/uv: move kmalloc() NULL check routine Message-ID: <20190905232951.GA28779@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The result of kmalloc should have been checked ahead of below statement: pqp = (struct bau_pq_entry *)vp; Move BUG_ON(!vp) before above statement. Signed-off-by: Austin Kim --- arch/x86/platform/uv/tlb_uv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 20c389a..5f0a96bf 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c @@ -1804,9 +1804,9 @@ static void pq_init(int node, int pnode) plsize = (DEST_Q_SIZE + 1) * sizeof(struct bau_pq_entry); vp = kmalloc_node(plsize, GFP_KERNEL, node); - pqp = (struct bau_pq_entry *)vp; - BUG_ON(!pqp); + BUG_ON(!vp); + pqp = (struct bau_pq_entry *)vp; cp = (char *)pqp + 31; pqp = (struct bau_pq_entry *)(((unsigned long)cp >> 5) << 5); -- 2.6.2