Received: by 2002:ac8:3b51:0:b0:3f3:9eb6:4eb6 with SMTP id r17csp1424564qtf; Fri, 16 Jun 2023 08:17:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HHvzQB/rcNa2Lv6cEFyva1AHj86Tj6TS4BalYLIOWfe75Rhg5p7gPDVrHehGQeuc02vjT X-Received: by 2002:a17:90a:19c9:b0:255:d86c:baec with SMTP id 9-20020a17090a19c900b00255d86cbaecmr1959270pjj.46.1686928630014; Fri, 16 Jun 2023 08:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686928629; cv=none; d=google.com; s=arc-20160816; b=RhpH+Gk66pxwXI04kO75ZVUk2tjCVHdzhqhPOSqlTeA9VuyyDK2B+mSH6k8NS0FyCb juD8pCqnT49+lMbpI2U1Z3CcS2oaoZphIoGZKV2OW2Okxh+38mpmbKjSd17CoGGOHk7X g1far2yXDwxruDwDH7PrySK4KbBZBgxsdLLNjubQSnW+uzt+a674tD5O29/508KkC4AG 8SpKarjfGhDM5yIGgnr65jrxsEoKhxvuTOArIYUqctHHXnVF5EuILRDfNXdbxurgBoGn w/OL1e/sSePtkNCJdT1FgqWgXNSOspaOOf4gGzRQQAmrVrcX0zTm5FmzXEUKtp0pAzwd oBpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LYXbUr+MtU+hikOpc58hnQV/8gF8b0KzgZpg3z0vo7Q=; b=Qrn1iHUuCEIJNO0yU1eYmiebN/IeNzMR2Pz83EPSZXt+vbSXh1UF+eXWohIfmkxy3x Eb09Ntt+7dY8uQHIMHnRQhptezyVjCJKGY3vuDgM+adTmXxgI+L1ekiAtk+vHKT0cpgn Y1x6wpOH0hQg3j77CXvYn7KwxIUypQVQ4+4+qVV9ansYkOo34JnkW4d21Mjcht7ZPh+f v6tUNhr8VEJlLC1y+9GzH2O26zT2i19bROc1D8MgAnEssZ0sVrAFC0mUA1Qj6jBQfArs LHdhot6Bit/4wMRlXOmC01y8w+73NDtCXN0egz5eH3KFXlOkOvtKeRGRkx9vUrS0rNBR Jh5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVvupX0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l128-20020a633e86000000b005533f9527c2si1603775pga.433.2023.06.16.08.16.53; Fri, 16 Jun 2023 08:17:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sVvupX0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1344017AbjFPO7O (ORCPT + 99 others); Fri, 16 Jun 2023 10:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbjFPO7M (ORCPT ); Fri, 16 Jun 2023 10:59:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1676730DD for ; Fri, 16 Jun 2023 07:59:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F8C562DC1 for ; Fri, 16 Jun 2023 14:59:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73531C433C8; Fri, 16 Jun 2023 14:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686927550; bh=ouesFuuU+y0Nvn7B/3cjuuMqNQ+7Jz9OIgReBwjtmnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sVvupX0Mhe8XEIF2EqILhm9enJ7MK/A4hXQrN8N+O/fKkWnpKXxRbuDCAybnPlWVE UosKsEJgUDE8EnqEYwiWhuy8vsoVdetOhpNSSSUGg4bf4f9A23svvGboeU6e8cCe7M MfucQG6fjlucX4HaiU1IOOfo+zBt1nORKlFXuZetiokJgKfDQuGUE56dFg9C5fAXsR k4+4GTyol9VIio0YAR8f5X/SHyhtnQxWuXD5jd14KjcgpYvRyppQ/p43fqnQ2SbZ6M P0XHDOwJPpXBKIFUiTRJh7t/x84DkPbI/zvth9rqZtcujLX4AzERnTMs6MalgdOxi5 1O9XG5eXQERTw== Date: Fri, 16 Jun 2023 15:59:06 +0100 From: Mark Brown To: Martin Fuzzey Cc: Support Opensource , Benjamin Bara , Adam Ward , linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: da9063: fix null pointer deref with partial DT config Message-ID: <49ba8434-f16e-415a-9059-1af532854cb0@sirena.org.uk> References: <20230616143736.2946173-1-martin.fuzzey@flowbird.group> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="G7fWAiFF1Z1ENwIb" Content-Disposition: inline In-Reply-To: <20230616143736.2946173-1-martin.fuzzey@flowbird.group> X-Cookie: P-K4 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --G7fWAiFF1Z1ENwIb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 16, 2023 at 04:36:28PM +0200, Martin Fuzzey wrote: > const struct notification_limit *uv_l =3D &constr->under_voltage_limits; > const struct notification_limit *ov_l =3D &constr->over_voltage_limits; > =20 > + if (!config->init_data) /* No config in DT, pointers will be invalid */ > + return 0; > + We already dereferenced above when we were initialising the variables, the compiler might still generate dereferences before it does the checks here. > /* make sure that only one severity is used to clarify if unchanged, en= abled or disabled */ > if ((!!uv_l->prot + !!uv_l->err + !!uv_l->warn) > 1) { > dev_err(config->dev, "%s: at most one voltage monitoring severity allo= wed!\n", > --=20 > 2.25.1 >=20 --G7fWAiFF1Z1ENwIb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSMeLkACgkQJNaLcl1U h9ARsAf/WXcWbB5wGqNklpDm3RFefRMp0Gw0WHwRklLY2iZf8u2D7MEevfYB6rVu g2fG5MPw8Bz1EyABS4NmVLBbqd/7spjvuSvSgfCCAjeHiCtE8OjuylZJdl/ZN/Du 3otyM9JhTO2sBIkFW7OEfCZ2vDiPUP5zUrcrgFu/1Gh8pB3Hz9KQqnA09anoBewW 8KseAkv+yM6t2YquHD2Q0ymAFznlf799VtKTMRJ6RUQdVdxUYh2tKu3NEyaAGa+R Jbv3uYYP8vL5z0+w7uGJokBNODaTs7seg0OYdEZGGXo658VG1qF+IKAHYIIzEyfg vTbiL2xiv9MRmuwgcp0rnihyO+hgcQ== =XvwL -----END PGP SIGNATURE----- --G7fWAiFF1Z1ENwIb--