From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42EEB2BD12; Fri, 5 Jan 2024 14:40:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PNsQAcd4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 638CEC433C7; Fri, 5 Jan 2024 14:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704465620; bh=zWgERpDN/8rp2FQGA0vqeAgYFnjmwSlbX1jKmjmK8Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNsQAcd46UjSyvIWxtURbINGNDAsIvkR/zfNOhUih/dQKFp+6XUCEF/nVFBMgXjCS GYkOG1YAj73Xp2dnbAJq5qgQx+7le535TfypikbJcjD7t+ors4Ftft4neVMb/bI9DC 0IpwYQPsA89zisgbeXE8wv779TWKjnZgQp4hwbao= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haoran Liu , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 09/21] Input: ipaq-micro-keys - add error handling for devm_kmemdup Date: Fri, 5 Jan 2024 15:38:56 +0100 Message-ID: <20240105143811.964756455@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105143811.536282337@linuxfoundation.org> References: <20240105143811.536282337@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haoran Liu [ Upstream commit 59b6a747e2d39227ac2325c5e29d6ab3bb070c2a ] Check the return value of i2c_add_adapter. Static analysis revealed that the function did not properly handle potential failures of i2c_add_adapter, which could lead to partial initialization of the I2C adapter and unstable operation. Signed-off-by: Haoran Liu Link: https://lore.kernel.org/r/20231203164653.38983-1-liuhaoran14@163.com Fixes: d7535ffa427b ("Input: driver for microcontroller keys on the iPaq h3xxx") Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/keyboard/ipaq-micro-keys.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/keyboard/ipaq-micro-keys.c b/drivers/input/keyboard/ipaq-micro-keys.c index 602900d1f9378..2d0d09ee9ab08 100644 --- a/drivers/input/keyboard/ipaq-micro-keys.c +++ b/drivers/input/keyboard/ipaq-micro-keys.c @@ -108,6 +108,9 @@ static int micro_key_probe(struct platform_device *pdev) keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes, keys->input->keycodesize * keys->input->keycodemax, GFP_KERNEL); + if (!keys->codes) + return -ENOMEM; + keys->input->keycode = keys->codes; __set_bit(EV_KEY, keys->input->evbit); -- 2.43.0