Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2501747lqb; Tue, 28 May 2024 01:36:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkzDIO6MJl0kSDKJHZFktMe+fQW4WgKJsGS9WPU1G3w1iOvsvp/rwgoJU+YSoObYRfEOjNYg+nuMwOps3rW2jEWEkG+spA6wZDHyNtoA== X-Google-Smtp-Source: AGHT+IE5FSiD3zCzqiEdB/6fS8NsmZjsVmUfgLGDLVJ1NIJPEXvCeoplxlH1dJ5hhVfGoOqGYnqP X-Received: by 2002:a05:6870:350b:b0:24f:cd06:c811 with SMTP id 586e51a60fabf-24fcd06cd71mr9508734fac.54.1716885362763; Tue, 28 May 2024 01:36:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716885362; cv=pass; d=google.com; s=arc-20160816; b=YtO3hnFlbJq0jP6GPPIlW0fsJUIeTlIiLURjKSsU72QRwvz1YpKpawW8mN5v399xPY jLfscdEkSib4wJ34SshhWDkKpwn/iM6l7wvLOwwatAVATivLBdu4ZsO7dwLu6EayqE4F YmkK0vS0bMGOReiXzEoBu455IaD69Y4K7rqpzGdJH1RZloKZh10tWU4+9KPILGjagWkD a5g+USML/ydYGR++4Z67gVGHHroZHlZ/VhuLP/oImdS9xLjDQfoXrz/HKD3I8LQBhUwj qRVVQMMHe6kQf1JdsX0tCdyK2pjI0dllGJT4gtogSSEfgWDTYTtvvopDNze38+F1jA8b LsIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:subject:cc:to:from:references:in-reply-to :dkim-signature; bh=MfEWqiPiowp1nxWFVOqmObG5hSUllA+ZfcuPMLVDwsA=; fh=mK9kOis22Xk26lWo2BJ9ARhM0hslSRucewsqeRLiLts=; b=WhN+RaBcjE/zyCYhn8zygu8KMCR7zWmFfq9+qTAcaF03FGj9Fa/TSxn/HqMoGDaO69 WJ9Ajq7WesSH3kTidnvHWpvpFqqhrHxxF3DAOTu6Jra2S3T4o4JsQVzM7wED1jr/nCpd r1e+LcDfrfeJm2clmC7olcJ9CqAZ89vxoXPYs9sXQCSgpVYllIk/DXSNgInsHjZLR5Am KFtdzK36ufnFpFbJDyEgRUYgI5FOEz4eG9Ke8Xi4dh3axYR2VLSsI6xylpAVzV4xgrbO meYoJEcLK4DYe4oYcV6Yk38Ah4QKWPSZwbDPsKv+xjy/breKpo8qP6Nb+dPaO43VlTM1 9Yhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=10dnc6xa; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-191918-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-68222ea5d31si8392767a12.220.2024.05.28.01.36.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 01:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191918-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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=10dnc6xa; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-191918-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk 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 D5376287871 for ; Tue, 28 May 2024 08:16:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77AC913AA59; Tue, 28 May 2024 08:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="10dnc6xa" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 77C9E17E8F9; Tue, 28 May 2024 08:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716884171; cv=none; b=esgmXTNzhWRTMdTQPN2rSJBBNzGMqhIyZA/HcBhYEJGzEh/ts95mWaDrxEnzRykOAa7DE4V8FecECeFMwXwt7r/Sgldeao5zB6zRaRh8Kc99PB9P8KK0tgHGuVORIfKaU0umBOUd3ib0NgWmCDKXNPQILjo1gcMUBejBQQXgRvo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716884171; c=relaxed/simple; bh=4V0unZZMxFYExMEXevIB43oB1N7X4q7IE6LTHwkEOtY=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=HpuIvNhA8PioQQgwjvh7vm+jGfkmf0wol4TzTjZuRuRurtCCfR+hOwxhD1Vddg6akWmle+wNYMeVPI2GsLRcoVeboq4PjhkcAV6a7Kk5/vQaTRRx/foQXb60QxgDt++jKztlJPfA1fv/+RJKjUUhOb0tWm+yOBULa2pT7KsoYYU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=10dnc6xa; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MfEWqiPiowp1nxWFVOqmObG5hSUllA+ZfcuPMLVDwsA=; b=10dnc6xahQf1TxfTvr7uj+8znz iy9kqoqnE0J1LuGy2fJwm8DiGSlcCZ/dKz3EyZVBxLQYZuJvL8mgYXwPV7TRpBMR8m+Rd5rHZGPZT YLG61wnlbrzHBWPG6LrxwSZF7sLqm6kU3NqVlb8tfY+ies3laLoLT4zfjhpKtyp6zseQfbhzGkGYw cavflUIu4T3bDZkxSOlJC+5aeJGGk+0Mo5O0i5fyDXySARhVvRJVTQ65MbTkyTCrSnMMqOTl/jLc6 EwSF8Jowza/7huTK5gKR4P/37p/XQ1/4TEmyXEgyuSlD18/7ZHdGscWhObb2F1mX+MIZq7YtE+nWl A0JAgQWQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:44848 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sBrzl-0004R8-10; Tue, 28 May 2024 09:15:45 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sBrzn-00E8GK-Ue; Tue, 28 May 2024 09:15:47 +0100 In-Reply-To: <28114882-f8d7-21bf-4536-a186e8d7a22a@w6rz.net> References: <28114882-f8d7-21bf-4536-a186e8d7a22a@w6rz.net> From: "Russell King (Oracle)" To: linux-clk@vger.kernel.org Cc: Stephen Boyd , Ron Economos , Samuel Holland , Guenter Roeck , AngeloGioacchino Del Regno , Dinh Nguyen , Krzysztof Kozlowski , Michael Turquette , Paul Walmsley , Rob Herring , Yang Li , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, regressions@lists.linux.dev Subject: [PATCH] clk: clkdev: don't fail clkdev_alloc() if over-sized Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Tue, 28 May 2024 09:15:47 +0100 Don't fail clkdev_alloc() if the strings are over-sized. In this case, the entry will not match during lookup, so its useless. However, since code fails if we return NULL leading to boot failure, return a dummy entry with the connection and device IDs set to "bad". Leave the warning so these problems can be found, and the useless wasteful clkdev registrations removed. Fixes: 8d532528ff6a ("clkdev: report over-sized strings when creating clkdev entries") Closes: https://lore.kernel.org/linux-clk/7eda7621-0dde-4153-89e4-172e4c095d01@roeck-us.net. Signed-off-by: Russell King (Oracle) --- Please try this patch, which should allow the platform to boot, bit will intentionally issue lots of warnings. There is a separate patch posted recently that removes the useless registration with clkdev. drivers/clk/clkdev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 6a77d7e201a9..2f83fb97c6fb 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -204,8 +204,15 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt, pr_err("%pV:%s: %s ID is greater than %zu\n", &vaf, con_id, failure, max_size); va_end(ap_copy); - kfree(cla); - return NULL; + + /* + * Don't fail in this case, but as the entry won't ever match just + * fill it with something that also won't match. + */ + strscpy(cla->con_id, "bad", sizeof(cla->con_id)); + strscpy(cla->dev_id, "bad", sizeof(cla->dev_id)); + + return &cla->cl; } static struct clk_lookup * -- 2.30.2