From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH AUTOSEL 5.3 169/203] x86/platform/uv: Fix kmalloc() NULL check routine Date: Tue, 1 Oct 2019 12:06:01 -0400 Message-ID: <20191001160601.GX8171@sasha-vm> References: <20190922184350.30563-1-sashal@kernel.org> <20190922184350.30563-169-sashal@kernel.org> <20190922202544.GA2719513@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Return-path: Content-Disposition: inline In-Reply-To: <20190922202544.GA2719513@kroah.com> Sender: stable-owner@vger.kernel.org To: Greg KH Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Austin Kim , Dimitri Sivanich , Hedi Berriche , Linus Torvalds , Mike Travis , Peter Zijlstra , Russ Anderson , Steve Wahl , Thomas Gleixner , allison@lohutok.net, andy@infradead.org, armijn@tjaldur.nl, bp@alien8.de, dvhart@infradead.org, hpa@zytor.com, kjlu@umn.edu, platform-driver-x86@vger.kernel.org, Ingo Molnar List-Id: platform-driver-x86.vger.kernel.org On Sun, Sep 22, 2019 at 10:25:44PM +0200, Greg KH wrote: >On Sun, Sep 22, 2019 at 02:43:15PM -0400, Sasha Levin wrote: >> From: Austin Kim >> >> [ Upstream commit 864b23f0169d5bff677e8443a7a90dfd6b090afc ] >> >> 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 >> Cc: Dimitri Sivanich >> Cc: Hedi Berriche >> Cc: Linus Torvalds >> Cc: Mike Travis >> Cc: Peter Zijlstra >> Cc: Russ Anderson >> Cc: Steve Wahl >> Cc: Thomas Gleixner >> Cc: allison@lohutok.net >> Cc: andy@infradead.org >> Cc: armijn@tjaldur.nl >> Cc: bp@alien8.de >> Cc: dvhart@infradead.org >> Cc: gregkh@linuxfoundation.org >> Cc: hpa@zytor.com >> Cc: kjlu@umn.edu >> Cc: platform-driver-x86@vger.kernel.org >> Link: https://lkml.kernel.org/r/20190905232951.GA28779@LGEARND20B15 >> Signed-off-by: Ingo Molnar >> Signed-off-by: Sasha Levin >> --- >> 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 20c389a91b803..5f0a96bf27a1f 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); >> > >How did this even get merged in the first place? I thought a number of >us complained about it. > >This isn't any change in code, and the original is just fine, the author >didn't realize how C works :( > >Please drop this. Heh, I've dropped it.