Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2974492yba; Mon, 22 Apr 2019 16:59:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7tsrBj7uftsMtdbzO7Cl/CGUdOGJ58W1zx5TNrTflw0PW5nbR7UGCwP5PZx8TN+coDgi6 X-Received: by 2002:a17:902:6b03:: with SMTP id o3mr22434349plk.226.1555977568369; Mon, 22 Apr 2019 16:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555977568; cv=none; d=google.com; s=arc-20160816; b=Auldjc9bHYh7x1WSvrQMm/RCQMrcYdNFR5EjlUHTK+vJ+PqeAktPRz056EMGwkyeZl ZZBksF/MSHQ1whzb4m0AT9CSqatCIbf0Nooqb14ig34USTlxs4xXiRasrs4yrgvsyzED 9jsUCEZEaK9SOnviEvpLigWO7158gcjUB2EwJwxtBvcJMraiYpUQs59iu5Ogqdcpp51U 7lByl+ScXs0Bu41yNpYa3S/cMAl7ylihTqmUvN+8nkEn25lpd6KiqbgkSgxOsimCsS+M lYmLWGC+C3YiIJIzPdraHfxBhBrn5u1vjDjoCAdrc3rYdwhaVtKZUUPUc74p2cRVMEyV 4AvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8in7XzT0JE0h9QzDLtw+B2qJKQJCfiDhtrlPyHnZCo4=; b=EaQwYpe4RQ+ZtifTJoj4UQ1QO0OoqLMlsjH4Q1at2eUAPok7KMLa0cm7noifJuDWLC 3iOnjaZkU66RFb/gINFlTeSbsNpfQlY3yXnbEXP7YoRQabM0QDAX2zQwUAGCV2dQFhM2 YYR4xL7aY/K7UDczz/VhP42AwUDm0YMOJdtbR+oRwzFwvusk8KUBezhTg+rffcyu2E7m orphNVzU2s8JHE5dXCFNXyJGUlw+VwrLPj9veRuHoWnZ4lqYycuEh5VlWpBt8hccA7Lq JiGxprB2eVyCXckJ+TITbmXrX4tuZBLGK4zpNsW/itqxpvjSg8KIUUuLJrw+QnaIfB/a zKTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EtFqG7mV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si14647393pfa.163.2019.04.22.16.59.13; Mon, 22 Apr 2019 16:59:28 -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=EtFqG7mV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732006AbfDVUBs (ORCPT + 99 others); Mon, 22 Apr 2019 16:01:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:49192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729263AbfDVTqs (ORCPT ); Mon, 22 Apr 2019 15:46:48 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6899F21902; Mon, 22 Apr 2019 19:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962408; bh=lVDDzm9TFuie7XILpz7bvsjkzwFaeevko5Hnsu2fDGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EtFqG7mVR6h8JuMG6BhqpZyT0l+L97y51SRWZzLI7gknWF+sM/zpx/dQs6Kce1L7i XhsMCoUW6kwhIPI369DcVYIAcckG97hXtRaGwDbbtI0kDGrOMEwJ1Z7GNxB50taQP7 MfU+y+2kZlExS/civH9wWGsz4B9SXJRKEUeceu+U= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , Bartosz Golaszewski , Sasha Levin , linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 44/68] gpio: aspeed: fix a potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:44:52 -0400 Message-Id: <20190422194516.11634-44-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kangjie Lu [ Upstream commit 6cf4511e9729c00a7306cf94085f9cc3c52ee723 ] In case devm_kzalloc, the patch returns ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu Reviewed-by: Andrew Jeffery Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin (Microsoft) --- drivers/gpio/gpio-aspeed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 2342e154029b..b696ec35efb3 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -1225,6 +1225,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) gpio->offset_timer = devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); + if (!gpio->offset_timer) + return -ENOMEM; return aspeed_gpio_setup_irqs(gpio, pdev); } -- 2.19.1