From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE4F7C4332F for ; Wed, 30 Mar 2022 19:00:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350266AbiC3TCO (ORCPT ); Wed, 30 Mar 2022 15:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350306AbiC3TCM (ORCPT ); Wed, 30 Mar 2022 15:02:12 -0400 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCE5265D3B; Wed, 30 Mar 2022 12:00:26 -0700 (PDT) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1nZdYO-0003Qd-01; Wed, 30 Mar 2022 21:00:24 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id 63D91C4DEF; Wed, 30 Mar 2022 20:34:48 +0200 (CEST) Date: Wed, 30 Mar 2022 20:34:48 +0200 From: Thomas Bogendoerfer To: xkernel.wang@foxmail.com Cc: john@phrozen.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] MIPS: lantiq: check the return value of kzalloc() Message-ID: <20220330183448.GB18042@alpha.franken.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Fri, Mar 25, 2022 at 07:49:41PM +0800, xkernel.wang@foxmail.com wrote: > From: Xiaoke Wang > > kzalloc() is a memory allocation function which can return NULL when > some internal memory errors happen. So it is better to check the > return value of it to prevent potential wrong memory access or > memory leak. > > Signed-off-by: Xiaoke Wang > --- > arch/mips/lantiq/falcon/sysctrl.c | 2 ++ > arch/mips/lantiq/xway/gptu.c | 2 ++ > arch/mips/lantiq/xway/sysctrl.c | 46 ++++++++++++++++++++----------- > 3 files changed, 34 insertions(+), 16 deletions(-) applied to mips-next. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]