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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CFDAC32793 for ; Wed, 18 Jan 2023 13:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=basRIZgm+q0NAdbgfTQWVx+VHhbspibwk4ggqtlosKY=; b=eN4FnTOopluZSG MU9bDzALVhjuDVqIF1jS5KWgQMS667XK2LPuF6ZNv/ppbx81NkOq84aP0la4agtvXOd8TriNbnaeE z02JXsAgksHOIvQII/VvsvMqf8va9DphNPGAGHfLl6kAMxLLbR85c3Bs6FiB07Xe7jNvU+EfNRr85 r+IuMzSw07gxetOPyM/ZmaSjxVcJzcngVPOzWw98mCk3rNYoYII8Wa2Rpc/sQbHCEBLGDKsJ7kzgR KJRwLk/VtoPKEs330cqdjksW9XNlexZ9R6UUUTxdrhLASGxQkMmbRJvAYi9EhGQjtFq4MMDWWar6P ORNHTpYaSvCFbrJzJbtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI8JW-0016cr-6e; Wed, 18 Jan 2023 13:17:14 +0000 Received: from vps0.lunn.ch ([156.67.10.101]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI8JT-0016at-3z for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 13:17:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=wd8rPoxSEOy2m/HQXKKEeOnbpnN+wzZH84RSXywB5Ok=; b=kE12tB6grAfclGwnHOd+B8gs3P ee+o8Uvt7azWscY1yd/rzi99XHXgRxhfEZHn3R39jBOfiABbzgWc4sjLQpcO6vTXBE9qItBwbepl4 UQxUcDsLwQLTLYQSYGcgCym4IBystWypGQa/JE3RPThemi/PaDlifX2DjigSh2g97v88=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pI8JI-002RSP-El; Wed, 18 Jan 2023 14:17:00 +0100 Date: Wed, 18 Jan 2023 14:17:00 +0100 From: Andrew Lunn To: ye.xingchen@zte.com.cn Cc: gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, chi.minghao@zte.com.cn Subject: Re: [PATCH] ARM: mvebu: potential dereference of null pointer Message-ID: References: <202301171822040406304@zte.com.cn> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202301171822040406304@zte.com.cn> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_051711_174810_90F823EB X-CRM114-Status: GOOD ( 16.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 17, 2023 at 06:22:04PM +0800, ye.xingchen@zte.com.cn wrote: > From: Minghao Chi > > The return value of kzalloc() needs to be checked. > To avoid use of null pointer in case of the failure of alloc. > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi > Signed-off-by: ye xingchen > --- > arch/arm/mach-mvebu/board-v7.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c > index fd5d0c8ff695..b93b4a8a8357 100644 > --- a/arch/arm/mach-mvebu/board-v7.c > +++ b/arch/arm/mach-mvebu/board-v7.c > @@ -125,7 +125,8 @@ static void __init i2c_quirk(void) > struct property *new_compat; > > new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL); > - > + if (!new_compat) > + return; > new_compat->name = kstrdup("compatible", GFP_KERNEL); > new_compat->length = sizeof("marvell,mv78230-a0-i2c"); > new_compat->value = kstrdup("marvell,mv78230-a0-i2c", Please add a blank line after the return statement. Also, i find it interested your bot is telling you about kzalloc, but totally ignoring kstrdup(). Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel