Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp802959ybe; Fri, 6 Sep 2019 07:33:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaEh/QwT9uZjHEpi5aXcC7Gebo72GNsT2GKmldivipnb4+rd6gQc3w+I2cH5OTFFla/Lx2 X-Received: by 2002:a05:6a00:8c:: with SMTP id c12mr10566793pfj.200.1567780426480; Fri, 06 Sep 2019 07:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567780426; cv=none; d=google.com; s=arc-20160816; b=vcGtCDBTyllOCfdXswtAA8fDm14vHBr6YkXgA8bFMdYrBANGo95suRIRYUL4pUHxqH yUk++Ye3uGj08BdwvfGay0QtS8pVDDcdmEzX0NCZDHzpgIyyubXOIVPJWRgUcS1u0WSW 5IG2MeyRYANOzOy+GkTV10It3QxkOsVAIJtdRy0hgcRVUViLGlvpMbEa6aqUcekdqCR0 W8Pb5EhsinWeB1VUwAFFaFo4JdSNOspBlm5cO53xfL7tgXwMgDMOlbeCAmrRA1EWNZU9 xy+UdRchp/CphG3FYsqUwc6z46+97r5eHy2666Nhvf8d0q/CPNzgRhwgthCga7HJg/Vp WF0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ay1Tbuxa21RRmKX1UCQB0ykCFYQz/H4YNfvCdZF238k=; b=nbBZnHP98mLaAPxpvZ7y8YANn1TslnOpa6tZcJ15bLGM2q4albi4VBfF98/wNWweMU jTSzk6joUqOetnuHRriQ9SVfnDpE82uZhA0DPxR9C2lvq9QDEMKRDiX3ciahHQOeoa3y txM10cDpD4+VTupzQHgWKCbNL7TmTWMiVF1doPeWNi9T76Vwm673zVb2B9/gwm6fMr3Q v398QMpoZRNqI5HRqIIme8Ibq1XAYvuxD0UH/mzgbXlC6qhsmbxFU7PnlxMyFW5Lz7aA CdtQQ7y4+3P3a6DzKhuw8IxpwstnOPMeKq5vLYy14tfwbJvViVUncl6AZbeGdUyebkKZ FQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N9p1q33D; 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 i3si4971959pld.28.2019.09.06.07.33.31; Fri, 06 Sep 2019 07:33:46 -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=@kernel.org header.s=default header.b=N9p1q33D; 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 S2392923AbfIFJcz (ORCPT + 99 others); Fri, 6 Sep 2019 05:32:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:49534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392912AbfIFJcy (ORCPT ); Fri, 6 Sep 2019 05:32:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F04832081B; Fri, 6 Sep 2019 09:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567762374; bh=cPDqk6aXgLbE+FjZ+dLvMyI1fQjEIqWJyXy+GFf60BE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N9p1q33DSeih0KQVKngEMuv4yWhp9cEYmvpkGXiwIyuCY/fTxSayvES0HnzP+/Xkz ACedDjqe59IqJcEfcQA/LpTQtx1fRdX7rDFFGWDs36lF/Fje5OPkvoHJdg5ZO5wPBq WmK7M5ooWAeATfBOv2PByyhNRJZf2M4DgtLJnaL4= Date: Fri, 6 Sep 2019 11:32:52 +0200 From: Greg KH To: Austin Kim Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, dvhart@infradead.org, andy@infradead.org, hpa@zytor.com, allison@lohutok.net, armijn@tjaldur.nl, kjlu@umn.edu, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/platform/uv: move kmalloc() NULL check routine Message-ID: <20190906093252.GB16843@kroah.com> References: <20190905232951.GA28779@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190905232951.GA28779@LGEARND20B15> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 08:29:51AM +0900, Austin Kim wrote: > 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); Ick! Don't crash the whole machine if you are out of memory, that's a totally lazy and broken driver. Fix this up properly please. But the original code is just fine (from a this is doing what I want it to do point of view), I don't see the need to change anything here, you did not modify any logic at all. thanks, greg k-h