Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp623466rdg; Thu, 12 Oct 2023 16:22:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZPhYDLk3R2wU2RZrd419iQBEgkmz/Co7u1wZ7NkzsS84dTv9wSoo0JhJowdKG2tDTBSId X-Received: by 2002:a17:90a:e147:b0:27d:c92:e897 with SMTP id ez7-20020a17090ae14700b0027d0c92e897mr5247718pjb.37.1697152932476; Thu, 12 Oct 2023 16:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697152932; cv=none; d=google.com; s=arc-20160816; b=uIEVNCz3T67gUZ6leUIc3XM9HbSgrxu93Nf/VndqP1IF231cuMovK0fx8n/SYIEuQ+ nYQxH2TJgCHuHzGY+WlzY5CXbjx4zwYPu+BoLKAm7V0cC836g22c+z8sCXHPJOgw8fOK DJLBn43Le3Bcl3JjWBH2sYOg9D5TGrH92lAVmFNNNHvqIbzHmX6DzNC3JK3R/Jq7J21P i1Q0NOtGQWtRrFRKnJTYYHHmpuRgREDfN6X6ELRw6ncVodVF/mCOjD0GRqOCm+3g2Xa4 XjhcAY3WKAT+1IR5U7PylaNeDnhOq/W9f+U9DOAHx7BWSn6UT2eEIQRnbBW23wUlXb05 drLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=EA6Bl+hhODmC0/E8k4cIgSih/ZiH5lISftxciVURJ/E=; fh=0tfh4sHVyIoGWCDnscqhdjZnVzNnWF0ELemHaBczqd4=; b=cvux752Yt44NuwMuyPwmHFkjCncXjJ2ZjxE1tEMhLjTUkR4N0kyhMrbVWKEjIb+c0a MXeXO3qNeUMxsWkONtiJwdtvEnnquJk9/CE+x/M2nBt7CY1qElIm5ht2uTjqsau8ARrn OtqPrS2wNVaf1j/rVn5uJNOqR6wdvwIB4pVZAxHdvu2OSfkmUl5YmQfpdmLshQ4BbUNA GJOobfvxfpzk0WJpN2NsRkd3N/1UaEe3xV8P2xBduSnuQ+JcGiLm8CGb4+Dl3kOd2fPr OeV9OQB2vNKwSn3PfPNHGeYtWSxc6rBKGzh9KkepTuzCxklyw1sR+eXzP9Alw7QWrvcs k0oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k2Xv5ewE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id qe15-20020a17090b4f8f00b0027d047d9070si3634282pjb.91.2023.10.12.16.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 16:22:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k2Xv5ewE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 71A6A803C47B; Thu, 12 Oct 2023 16:22:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443083AbjJLXWA (ORCPT + 99 others); Thu, 12 Oct 2023 19:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443006AbjJLXV6 (ORCPT ); Thu, 12 Oct 2023 19:21:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 720BEA9; Thu, 12 Oct 2023 16:21:57 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E20AC433C8; Thu, 12 Oct 2023 23:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697152917; bh=EA6Bl+hhODmC0/E8k4cIgSih/ZiH5lISftxciVURJ/E=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=k2Xv5ewEz5mm7XAmyzk48w9floovjPuJtd9MQLAHpAbU2AUUz/zfcXdbppK+BWnzW 3xm+kZzb7CLusCkj52UvQjxq66Lnq4YrYzib90M1Tpsac6hxfyBFJ9SAbthpRXQUb/ B7DGSlzntsrElca2mcILI66lPuTPyCiKJBoUWWyJT8k0ihwIkMSnre65noLGUUBs6r sKeWY9Eod3+pLx4OaJn8ofOn+dMfs9g47Uj3rQD1FTBdBPO6WumirFADMhPcu2a+w5 6pGodNQWQcsylhC+vEZPsYnGCtCEW3XBr62uaJl/WRYt1oJ5ZoStRTQ/ePdQXq2hc6 mxAfWiJ2sUw3Q== Message-ID: <2350c4a3e6c2ed214dd232abc73b2074.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230921073217.572151-1-alessandro.carminati@gmail.com> References: <20230921073217.572151-1-alessandro.carminati@gmail.com> Subject: Re: [PATCH v2] clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name From: Stephen Boyd Cc: Alessandro Carminati , linux-kernel@vger.kernel.org, Michael Turquette , Philip Daly To: Alessandro Carminati (Red Hat) , linux-clk@vger.kernel.org Date: Thu, 12 Oct 2023 16:21:54 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 16:22:10 -0700 (PDT) Quoting Alessandro Carminati (Red Hat) (2023-09-21 00:32:17) > From: Alessandro Carminati >=20 > In the possible_parent_show function, ensure proper handling of the return > value from of_clk_get_parent_name to prevent potential issues arising from > a NULL return. > The current implementation invokes seq_puts directly on the result of > of_clk_get_parent_name without verifying the return value, which can lead > to kernel panic if the function returns NULL. >=20 > This patch addresses the concern by introducing a check on the return > value of of_clk_get_parent_name. If the return value is not NULL, the > function proceeds to call seq_puts, providing the returned value as > argument. > However, if of_clk_get_parent_name returns NULL, the function provides a > static string as argument, avoiding the panic. >=20 > Fixes: 1ccc0ddf046a ("clk: Use seq_puts() in possible_parent_show()") > Reported-by: Philip Daly > Signed-off-by: Alessandro Carminati (Red Hat) > --- Applied to clk-fixes