Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2989248rdb; Tue, 26 Dec 2023 11:44:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFJwJi7wJYfW9rxwXuNuiYkLXZ3sEMtXGtNCCKVQSQZGxay/yHJEqO17AOxgNtJfftV/DT X-Received: by 2002:a17:903:454:b0:1d3:47ba:ba45 with SMTP id iw20-20020a170903045400b001d347baba45mr7492948plb.136.1703619847006; Tue, 26 Dec 2023 11:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703619846; cv=none; d=google.com; s=arc-20160816; b=ZFvdzcsu7ctz3az/cx3icZUuIYthYAQ2xQPPKEiDl4qkfLg4JqnSfCQERp1kOdYPj8 87nOwsNsWr8Ophq6aqEMjhgHOEx7Ht59ImrU2gpNr0D8AdpMLeI+QqMocmmrhFcXOiO4 wFR+AegRheJ0ZdfvCaaxAPEa6IsgwGXA5S0LzBpwVMe/1g2XdQOtprKvpKs6c6CSH9aU FdsoYSRLWn+T0zUiOesiODwlDDfXYdjnc+e0xguRi6AZREwK+kcEOebFWxylyk/aZ+4h hx7RoRL86DmumBUUSGYBy1rPKkLyfiHe0SJ5steehXdy512/xLZCJdJRc40QjqTfREj1 5p6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:subject:from:cc :content-language:to:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Yz5BNYFI4Mk4f05xYuM6k+XbzVrG3PN+bLt3Unt/YD8=; fh=EN4acomdC2bcgEisX63cvwi+K11bf6xuF/585basy1U=; b=onRxrUPzfpOoyf7X3yppyyGJVLqPfM369lRz1bWh6q4VQJraLLXapnVZkn1YLKInsf AHzP1ddgt7KR2H1x45yGROUDROg/60+qPYRsZMbhsfVGO5O+pdncT0B1T3Df7YPWNI+5 x6P6CRmmjlK7Myb5eAgocirbabEH42pnvANH83eT8/wxKkUUXy89/vQMUobHr6o16K82 ciJcaimc5zWKosMc8jaICd9J7mybNI5QD786ekqGQklqZy3HL2t44oxqIxhEdtLD3bHp pMw1GuHfZxeJyBp8Nzfsl3OxsKetmtyaT2jRZ9JwFibaKM+UKHZ67AJ2orEvlrqgYHzj c49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=fBOhzl+r; spf=pass (google.com: domain of linux-kernel+bounces-11658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jj20-20020a170903049400b001d3b51b8897si9800754plb.337.2023.12.26.11.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 11:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=fBOhzl+r; spf=pass (google.com: domain of linux-kernel+bounces-11658-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de 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 0506A28345F for ; Tue, 26 Dec 2023 19:44:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 561D8257D; Tue, 26 Dec 2023 19:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="fBOhzl+r" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.web.de (mout.web.de [217.72.192.78]) (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 AFF6F5221; Tue, 26 Dec 2023 19:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703619819; x=1704224619; i=markus.elfring@web.de; bh=kfUrqzz13/SvRJXYn0ERTOI/fh6ulUnX5zFEb1O64Js=; h=X-UI-Sender-Class:Date:To:Cc:From:Subject; b=fBOhzl+rNglrGfAE5U6T/gr7Mcos5BQiia4AiECPLcFxE5boaMpuyvWYg3qXNQo/ adlFWcdh/FSb/vR2Lg86/GKHSvAeI0wB1SMZnRyzYwEjw8mm9+EF+uoYyCG5Lofj4 fSA+bPafsWBoR2IAZMCUkko4/1aIarO7bKMcqt0NauJmCDebcE2coRytaIVfESeG1 KIPMJ51KyTOtB+DUwHSoA5l1uFG/JQfX8Grt5PxKx6zmONmVYO5Bnlut13dYffHsC f+syDNPaKXK/iMN/bEy473NZsaJXd12tdW08Ik3jwGaNLwkaRLg/4vf2qb49tq105 q5lVTJXlS4hLCVV/rw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MhFlo-1qn1SL0xuM-00eWrU; Tue, 26 Dec 2023 20:43:39 +0100 Message-ID: <5088a905-4f29-41d3-a96e-5b66aad551f1@web.de> Date: Tue, 26 Dec 2023 20:43:37 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org, Dmitry Torokhov , Henrik Rydberg Content-Language: en-GB Cc: LKML , cocci@inria.fr From: Markus Elfring Subject: [PATCH] Input: MT - Return directly after a failed kzalloc() in input_mt_init_slots() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:a8q13dW4fWVw2Hjfg84VQkwXU+SMTB/VfKaMZFUi+rSbfT92EII 2KooLkW2Dt1N9cTE4m8DJ1HBbo4D5rqf0iDdRWR8KpJTnq59BWm8uAfCr2a/hZJHirCNjXJ 4l9HsAHIOoSz2pE9twVSlBijktomx1LJ3hXmLqLS8OoA7gXYLMDQVJwWKL97573cEZNpkMW RxqfNn9aqV3fQjdpHC7Cw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:8pD2t0jv3V0=;6PXCgp1FFSxhp3Tffor/temmFSg 895atRLT+C3nCeMjM3n1oRHwvgFOcktzBWruWZEu5ZsGaxTbuyYtv2rGGKUslWmPgpexSpWL+ wXULaZMfngAAw6HlTtXgX2N5PgaFtL8hImDr+fnVQYlQ4bArZqprAJXtrpUs5COQSHWfqlIva WVUP2Hlo+soijfzzP4Hxi2N6rZXmYYzQIpcHjVSuKcb//ryfLvy2dFeibU1YzAIR6OdRMWVIw PScT4n1dy7v+uoIjO2a78SPpJoAkmvKE1JkEPkaqunOmP+PJ3N5SpicZt172/MbIArELY5MB3 Fxffx5qL8ripKt3ZHJ0NuqUlUR59TnNpeHEwW/NBIK34glXJ0KrIYPCkaxt5uvf2L0ZQXsn5B Tis9pVoqRq2nCMZKCEf/zikkeGZEG5pVPgmAyel3u9zK5UTQJGzbTNqGaUM+2VrU8k5/QgAaK O1veTuapZJuIYZY/J7GM1Sy3jVVDjfpp9LX9/6w8KZsxuQqgH/aSDOIVh3feJqPcm2Jse6RxD hBaK3Y0igDbFy82DRMlqZ+4Bsm0Ky7c3aIQEsz9xfVnAjr1i1Xj0ZvmW21RVlExwVYfjteYln DmbvanRgUBMVtAllhsVg45iKkkZDMX4EOtGd2Y3IetOoGMxxuuG7xeMCNShOEd01tWQ85vmv7 bWRPB9vH5o2o6rsp0q56uXa5kpUaYRPIa2HGQtR3x5Ak7M+thOfifL9PXQyhvh4OaGwh903wH ePem5rBifH6vYxAzwSljTbLR/EmbhLaBPmqqdS7EG796xRTBswHFa6B07v91Q5vScFOZpOS5c Efd7dLd25gd4f8vambmPhJEErXnP5NdACQ+/a9LO97qNdgNhXmmFXij6tTAuybNdxbNkIF/tM XmyBK/Oln1d3IMon2CHHb9avCOFZWG7dXOIArCyAhV2ZUFTDSVXVVgiGYTF1+6ldsB3Tz7C6i uPK6oA== From: Markus Elfring Date: Tue, 26 Dec 2023 20:36:09 +0100 The kfree() function was called in one case by the input_mt_init_slots() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. Thus return directly after a call of the function =E2=80=9Ckzalloc=E2=80= =9D failed at the beginning. Signed-off-by: Markus Elfring =2D-- drivers/input/input-mt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 14b53dac1253..24064447d600 100644 =2D-- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -49,7 +49,7 @@ int input_mt_init_slots(struct input_dev *dev, unsigned = int num_slots, mt =3D kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL); if (!mt) - goto err_mem; + return -ENOMEM; mt->num_slots =3D num_slots; mt->flags =3D flags; =2D- 2.43.0