Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp319114rdb; Sun, 14 Jan 2024 19:46:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3xutauIkxXlqO405JI8tvEbIc+4dx0XMr8I91iWvDKFQxTFhnZB0P4mhgKqPkIpkzmrVE X-Received: by 2002:a17:902:9344:b0:1d4:3795:710f with SMTP id g4-20020a170902934400b001d43795710fmr1878720plp.135.1705290360205; Sun, 14 Jan 2024 19:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705290360; cv=none; d=google.com; s=arc-20160816; b=0H48+A/sbXYDar/7I3VFzTDVjQeXFll6f01KgJU/OkW/fSa6gbGKaeV2O8V403B8Ju SM79Hipzr1XJuQ2v0i5hruOAS40DIvNCTO46XMVdQRI68ruBPUfNiiANG8Tic9Kr60nD P5SfyLvqj3ahR2QJq4Fspk2PfQgo0Jrthslu8GEcY4K3+QVxJE0nvMy74+7+GxxlvpHf E/j9gk+exe9WYXFBtSskp9YZKkgyde2+m2R2uMQnnXB3MFX+nXD9UujuW3x6O/dh4/Yo MF2FTkN3CFcimU25Rkc8reE0KUFY9BShSuaR6oU8KwdCASj7Pzgty2wu7FJ2FjNltnhr vY7A== ARC-Message-Signature: i=1; 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:message-id:subject:cc :to:from:date:dkim-signature; bh=gSQcpz5a2KA1WVbsWMo1PtzyS08hgWrM79E7/t9KzpM=; fh=W/phKB3JP0/LYyzfdqzVVR5UJfdSdLy5J6y0BLPHY40=; b=Q4xhxixnfbe1/ABYXqf9ak5jJ3QfzzkygS1W18LciHGS+s7oII3dTIuGK711FPfN8F QGdBzQ3uC3AlPKjP53GAHFU8D6Lmc/WvUJNeIIgox8/IFTFLQgnhMfp/AbiW7iPjQh4j Zon5tgxLpV66sYWufX6hSXBkdhG+dDIVmYMHTw78s8BwR9y0Af0SQwphpPJfa31zKI7E CFFF/NqXnAIvA/VTraMh5H7k3NHgKpDh/JvTkAKau9Fyc7JIVjVIn7y5kC4D6+PJbx0T wtnOeqy8g4HOsNWnuXBMUpPeE9h0c8bngEvMY572xJfwDVoLjEqF/VHD9HyPoAcc05Ed rX9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=fDMXDdmo; spf=pass (google.com: domain of linux-kernel+bounces-25608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jj18-20020a170903049200b001d4c4bdc0e0si8168016plb.537.2024.01.14.19.46.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 19:46:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25608-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=@lunn.ch header.s=20171124 header.b=fDMXDdmo; spf=pass (google.com: domain of linux-kernel+bounces-25608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 DFC612815CE for ; Mon, 15 Jan 2024 03:45:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 357821FDD; Mon, 15 Jan 2024 03:45:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="fDMXDdmo" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 DF0191842; Mon, 15 Jan 2024 03:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=gSQcpz5a2KA1WVbsWMo1PtzyS08hgWrM79E7/t9KzpM=; b=fDMXDdmoA2Vt2xVK1N1NFXceLm 01Gy+DsDk8UUwY6o8HeunPTZuL8bABCDc9r/tV8u0Jspr7Snb+NXY6FgIxscJt5s2OccosgzFXfw6 4wFiGBAqFbMtRcLJVpPCYgv1HUEVHv00yAk//tu5FEpgHNyrCiOpnRKxUUsYCb2WsSv4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rPDub-005Cau-LK; Mon, 15 Jan 2024 04:45:21 +0100 Date: Mon, 15 Jan 2024 04:45:21 +0100 From: Andrew Lunn To: Kunwu Chan Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: phy: Fix possible NULL pointer dereference issues caused by phy_attached_info_irq Message-ID: References: <20240112095724.154197-1-chentao@kylinos.cn> <627c9558-04df-43a6-b6e4-a13f24a8bc1d@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > > Here, i would just skip the print and continue with the reset of the > > function. The print is just useful information, its not a big problem > > if its not printed. However, if this function does not complete, the > > network interface is likely to be dead. > Thanks for the reminder. > The second part doesn't look so perfect, can we just print an empty string > when the irq_str is empty? > > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -1886,7 +1886,7 @@ static int phylink_bringup_phy(struct phylink *pl, > struct phy_device *phy, > irq_str = phy_attached_info_irq(phy); > phylink_info(pl, > "PHY [%s] driver [%s] (irq=%s)\n", > - dev_name(&phy->mdio.dev), phy->drv->name, irq_str); > + dev_name(&phy->mdio.dev), phy->drv->name, irq_str ? > irq_str : ""); > kfree(irq_str); That is O.K, or skip the whole phylink_info(). Andrew