Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp775370rbb; Sun, 25 Feb 2024 03:30:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXLduKAIAdZWh1PdyDRih8WSCpocli72v2h3SjfOck4NyIZ4fYya2L43XV4TOFgZ3noPx8GjtLnCEb32kFeJiGU9ZB+EhnN9kj2c4w22A== X-Google-Smtp-Source: AGHT+IEBA1T9qr7stXXEMBxkGe4YvSAjE6nPl/NKfGEfSh9uDspRI5S1+EgxEDCmHwSounDyl8Ce X-Received: by 2002:a05:6358:3107:b0:178:9b37:79f0 with SMTP id c7-20020a056358310700b001789b3779f0mr5108148rwe.32.1708860619622; Sun, 25 Feb 2024 03:30:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708860619; cv=pass; d=google.com; s=arc-20160816; b=u2+AB5CUgKuSMWhZxIFoLa1XelMJpS4v6wA3vDu2RBCntVAFyU5SE+GBi8XDBpYbXc FV5nMi3FUVFwNkPNi5QsM0BI3YMGhBDA0nz6ew7oGp5hxL9EY4EJY/dYR/96UAMZlON+ SOii9C7/612WXNpHIVdfn2FDJB2/Y3RlqESxhcr4JFWNBGQ4ndTTFqK55TMiR8O8JNwZ r5fklO45k8/wvNWN7KFm0wTCFBexfY0pYW9viaCmA2aTluTFUPXUfMO3EC6uqlDQ1OmJ p2dRKzSGK+bItxIzf3CNuJ1S/uX2HQANJHy782msasU2RtaAK6ZK4kfMN+2lqqHfPnO8 mxEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=Qt7H2ZIh3v/Vcrg3evn+aruHV87xiNC9x1F3o9juqsA=; fh=TBKLiHwodyriwh9kaSZ8EnErIt37psxsLeP0YasS4HQ=; b=ZHWv7HvRCq5KB3u4MHUdTBaakf8ALrfW/43E9d0faqop8LX+xA1SYXOrtRf2PKA8Lq yhqa0x6stOzcgkNLN/u37v180O4l3wP4RVwkJ1v18ffbVcc10MzKab0IBm9e+MidFI9v 04OwLahmrFT9GUtVEfOp9nlHKRqIL8A5hRIaJk1EM8sG7VAlUFXEzVEiXb8c5r/OenwO hIOs0dVe6cO/5maoUwH4VKJkUhsb2CRZq/DS/9n761RKx9RHHqS3bWBW/mgoJwDSMMJQ PS5j7SrR6KpkQrEe+S0o9Hos+fw2lY7fUvfUrqAY5R0faZNlLkcR4vanUJjYnp/gxw8N j/8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=cDHw84OK; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-80043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r11-20020a17090ad40b00b002903e315e4bsi2183220pju.81.2024.02.25.03.30.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 03:30:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=cDHw84OK; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-80043-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 34C7528178A for ; Sun, 25 Feb 2024 11:30:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D3B71078F; Sun, 25 Feb 2024 11:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="cDHw84OK" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 137D9EED5 for ; Sun, 25 Feb 2024 11:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708860612; cv=none; b=GHPLhZwaKbFgomAmfyi8na0qaQfVti0LOF3TTMwlXLVqpHt/02lcc3lmtYKzM8G15R9PzkujPhOuMG53S6iGZOGhsw+2VxEi8VCbi45ZccII9y6CFdINu5VrIM4fwIoVNKpkY0lBw5qNg442TN6KFxW3CFpjdbsl67Xi8ilQ3RM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708860612; c=relaxed/simple; bh=UVhXejR51p5Xsll/zCIUXGrfGXiTqG5GKQQs5cTWIqE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nyt/GlDmxoDDWHN23aboIaVHynrp0GzYRao7+8y+dw6+iagqbBxfR1G5psWoFiSv5ByLowiN1tVCTYaGL9rUcBcsfCtidDeYUYLvFNh6q6McIjH3y+O0idvS865g60QuUWCPJOMEkqeDiUi0N4b1RDqErRseQvYcyGtBKWNyx2c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=cDHw84OK; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qt7H2ZIh3v/Vcrg3evn+aruHV87xiNC9x1F3o9juqsA=; b=cDHw84OKV28nQBC6K8olsExeJA VSrWnBpyRHxPC5ZjzqX5aXz4lrpdcrGSEd3WmYoWDeSTKrkxpJWcdjHm8U/VRZOboPIkdNJPPBSg8 kctsmTYCGW/UQ9DWoAKu9rI6K1KZDA5gh9VcDLNNuR0o4rmCbcKgpujj7bNLGwI2UhQhiZu0zaTuE sNAJVDqhiW6rFNZ6RPYp/2eceULS3mA9ZE6C8a3iaq4T/wAzEN+9qnmFCAh9TF2tzC/D9X8Njw0gf r+UykDIQsUlc8LIjJ/HQdYuLRsD1qmOnzo18mqhgx7+Q11ke63Mcvvf1iI182yJd87vHjaiZ710Mn nYbZqd8w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:54804) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1reChh-0007Mq-23; Sun, 25 Feb 2024 11:29:57 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1reChe-0005TB-3y; Sun, 25 Feb 2024 11:29:54 +0000 Date: Sun, 25 Feb 2024 11:29:53 +0000 From: "Russell King (Oracle)" To: Duoming Zhou Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com Subject: Re: [PATCH] ARM: mvebu: Prevent null pointer dereference caused by kzalloc failure Message-ID: References: <20240225060401.52768-1-duoming@zju.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240225060401.52768-1-duoming@zju.edu.cn> Sender: Russell King (Oracle) On Sun, Feb 25, 2024 at 02:04:01PM +0800, Duoming Zhou wrote: > The kzalloc() in i2c_quirk() will return null if the physical > memory has run out. As a result, if we dereference the new_compat > pointer, the null pointer dereference bug will happen. > > This patch adds a check to avoid null pointer dereference. Yet again another janitorial patch that is Way too focused on a single issue, rather than analysing the code and proposing the best fix. :( What if the two kstrdup() fail? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!