Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1586934rdb; Sat, 3 Feb 2024 12:44:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqbBsLtp2kQSaRg1Y99mapXzlkD+1J8FJ6LmCu1oiLyB7lWYuwWBrEucIvUl+kIxLL7Ynn X-Received: by 2002:a05:6870:f14a:b0:219:5dc9:691a with SMTP id l10-20020a056870f14a00b002195dc9691amr1573680oac.47.1706993095451; Sat, 03 Feb 2024 12:44:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706993095; cv=pass; d=google.com; s=arc-20160816; b=J1UNp5qvPuvbFo6upOA57Ip0c0PPoWdoS14vBuBh+j4CdlXQcmJJCTgBmWwCbujvDV 3Ek6zw0XxpKe8kqPD+WQSk/p+D+STKwhcxm0E8+yh1DswijtOxu37xggpJG2/5kCoFAg h2cKLLolaxKL2YmMM1S74XxTmhJlfwhcO6KIjhsvjmx6ZSZoxcSvsfL9eWMW1vI3UGZm FfNS97nVy0LbJ9t+jjfSiByY7EhRldkFKiybts1oR0HNKr0sTB8OGlLXSF/9QFnSiFiX te68fkeuhwqRN9nF4NTb3IfbnKim7y7UhVOjLJxZcBduv0igXNZAReoAV1pCBigD0ORO rMMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=x/oqty0khXvRPmeM2qld9ejEfXUIdA5TFFykrWN2wRU=; fh=C2Xdzy8KwozsMHiVVfHfso6VvtiGiOYa7QHPCfFPBAE=; b=acUNsHv98B+x1TRsM1dbGl7hUxgHYV5slqirSlet/k9odKDz4YZGuanV92j/Bqga0m TfOYZBDuEGeGFBGRT1T0aNWW+7NB85DKcOvzwP/DAGY56QQ6WoDUiYp5gS2rL1dgeSt4 euu8ECqWFeL9mJ60AhalYU8nVyHQpqzKvn/EbsL6k1iAXYWCPoMaRvuKTip+vioQQczw o0ojLBUV69fU6FdEYFDtFKaa0br0J7duPycu3X/nqTOf5huA+n8lrIgF/Rma4Y6sipKq yyBAT0MrZ/T9w5vDPhzKxnjTQU32mHQnNSDqOsWiTaB1AkRcNNKv20en4fs3nwuDfoFR HFvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uAvlptMw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXfLahUXauCzXjyUttTZTXraUKWk3eYJEjny98hWwmYAlPvuvGlvG2QFXSJYhQYWQA9RRv0S3Hy6dN4q2z/f3XT4F+Cz4vRlyIK9QshOw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b11-20020a63d30b000000b005d8b2b49e8bsi3591527pgg.662.2024.02.03.12.44.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 12:44:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51288-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=pass header.i=@kernel.org header.s=k20201202 header.b=uAvlptMw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51288-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 83561283674 for ; Sat, 3 Feb 2024 20:44:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2AE912B9A; Sat, 3 Feb 2024 20:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uAvlptMw" 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 C464E12B60; Sat, 3 Feb 2024 20:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706993084; cv=none; b=OQwhIWVDk+UVOPpbTW9XH8Z1ZPttCVsqbo5poO3jJhfI4fphQjgTsOXomlwJ5q93VcWhoO+LAUg7LswaepwODtto2yTDdWEh1FItd7G+1EfK4dnlEhpnf/xdkOvhPjh45jdIo3vH6Meq0HzYIRtVa6CaYEwInC6mo2D9+kyVxcA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706993084; c=relaxed/simple; bh=x/oqty0khXvRPmeM2qld9ejEfXUIdA5TFFykrWN2wRU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hpuP/3bPxYF4ScGx2YnjUcMLgbbKkMVuVbDSszmqpYpBmIvDtgMge0MJnZqoU7ZF5X587ouFv2tnFQWrFyXrvM+9XWp1ZjVXsu/VJKWkkaf5KGPlIuw4zey8q0N2W7syKjtnTC+zkBF5J7RUUFBUbsYc6CD9TevjNHePD26IEj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uAvlptMw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1CB5C433C7; Sat, 3 Feb 2024 20:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706993084; bh=x/oqty0khXvRPmeM2qld9ejEfXUIdA5TFFykrWN2wRU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uAvlptMwBN8IRS1KUwxHSKLksiK2lRlKumrYzNBRolXCz4OPWO2JWGwRIlZSwLJa4 CYgCsVYcaqNFTJtfPOHut6MdQjq0Ww6C/aPKmk395M2e7xKPYmFGWlOClv5LuwWNKA 1eUL5MTDJVi+S7/3zVRlb/JQ7Syo7Cr2BkjjuhAii985cdnoRaU4KL4+koQuMR+dAZ fPlo/yrNQ9qJ+mtrioHuOS/MHE1MLBLbhlIo7UQp32ol4Ft+yf9GB3XyYvDuMZD3/O wU/+rF+PftYAu3oRasyvGDmNEJNxILk10SEIoCuzUDkcBquvKlKsm0OA0zagKyE0Jx gChlHBhYngANg== Date: Sat, 3 Feb 2024 21:44:40 +0100 From: Wolfram Sang To: Fedor Pchelkin Cc: Tali Perry , Rand Deeb , lvc-project@linuxtesting.org, voskresenski.stanislav@confident.ru, Benjamin Fair , Avi Fishman , Patrick Venture , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Nancy Yuen , linux-i2c@vger.kernel.org, deeb.rand@confident.ru, Tomer Maimon Subject: Re: Re: [lvc-project] [PATCH] i2c: Fix NULL pointer dereference in npcm_i2c_reg_slave Message-ID: Mail-Followup-To: Wolfram Sang , Fedor Pchelkin , Tali Perry , Rand Deeb , lvc-project@linuxtesting.org, voskresenski.stanislav@confident.ru, Benjamin Fair , Avi Fishman , Patrick Venture , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Nancy Yuen , linux-i2c@vger.kernel.org, deeb.rand@confident.ru, Tomer Maimon References: <20240109145121.8850-1-rand.sec96@gmail.com> <111837c6-6c60-4bd4-9e66-1c652a43f3ae-pchelkin@ispras.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4qMMyxx03EcHjoHW" Content-Disposition: inline In-Reply-To: <111837c6-6c60-4bd4-9e66-1c652a43f3ae-pchelkin@ispras.ru> --4qMMyxx03EcHjoHW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > If I'm not missing something, npcm_i2c_reg_slave() is called via a > function pointer ->reg_slave here [1]. And seems `client` can't be NULL > there. Other drivers implementing ->reg_slave function don't check its > argument. Correct, we trust ourselves here. > Maybe we should just drop `if (!bus->slave)` check? Yes. --4qMMyxx03EcHjoHW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmW+pbgACgkQFA3kzBSg KbZ35BAAnKpAXvpH6l/0FPmAfClZMt4L47HMb59BDAJvcvRxKNRo+RZD9Q2Z42BD Agz8OGyuvPVs29cZEmza509ZzTnBJRjfqHQssdFJpK8i+t0APRiLxAYDwsT1IdWb s1zUCno2d8vlIQMRpP9558NcWCdQxGgBES4wqVtsYNMx54XuLIO3P4Hm1h4MU7fb BQCmVccAIDmLAk8KTpHio7y6/00kfeqTAclqF0yVD8/71JAXR1bR6isDdKLMDMTs xrEInejo4tj1FkJdCZV+nBk2bweVGRiW909UB/9hqMaKY54I7MKp4qludDsKEhTJ 8LWe2OlIsqvHYGOHGPHDA/HVQV4T3HcGGrVSdyQrbSTPBRsTg/EXNJ1s7mr18aB7 g+0QVQ32NO+Pi3otwTXvnu7tg7u9Xae4v18fOdFiK/ezzFnxISZT7p+khMQdkcKv y2ymfN0UD+JqVOs0dhielqZI8bt98MAy3ngZqTX3vKBejfmsgYO7kkJJiApr6h4B n1KGg6tMb87K7S6lUlh4E0IFRtLzQDvDFnEDAH8uhjIcWVe8mLvVvdnYYYIpFP6N KrYZEUCBfgmlHyuBYW1vtFMwy28oKhND0v4aCbk9DChb6H+b4WwQE9teTXdQKTfy 07gyCLvRK0eLCbYJFSQHvnK5q9Giv7Moy+h8Z77VRMypA56VwfU= =oFAy -----END PGP SIGNATURE----- --4qMMyxx03EcHjoHW--