From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
To: huhai <15815827059@163.com>
Cc: netdev@vger.kernel.org, Henry Hu <huhai@kylinos.cn>,
stable@vger.kernel.org, kuba@kernel.org, andrew@lunn.ch,
divya.koppera@microchip.com
Subject: Re: [PATCH net v2] net: phy: microchip_t1: fix NULL pointer dereference in lan887x_phy_init()
Date: Thu, 3 Sep 2026 20:13:29 +0800 [thread overview]
Message-ID: <2c641835-006b-4511-b273-c2956d474801@linux.dev> (raw)
In-Reply-To: <20260903113046.163630-1-15815827059@163.com>
在 2026/9/3 19:30, huhai 写道:
> From: Henry Hu <huhai@kylinos.cn>
>
> The issue was discovered via smatch static analyzer:
>
> make CHECK="smatch -p=kernel" C=2 drivers/net/phy/microchip_t1.o
> CHECK scripts/mod/empty.c
> DESCEND objtool
> CHECK drivers/net/phy/microchip_t1.c
> drivers/net/phy/microchip_t1.c:1295 lan887x_phy_init() warn: 'priv->clock' can also be NULL
>
> mchp_rds_ptp_probe() returns NULL when CONFIG_MICROCHIP_PHY_RDS_PTP or
> CONFIG_PTP_1588_CLOCK is disabled. However, lan887x_phy_init() only checks
> for an error pointer before using the returned clock to configure the
> periodic output pin, which can result in a NULL pointer dereference.
>
> Handle the NULL return as PTP being unavailable and skip the event pin
> configuration in that case. Smatch no longer reports the NULL dereference
> warning after the change.
>
> Fixes: 8541fc12edcd ("net: phy: microchip_t1: Enable pin out specific to lan887x phy for PEROUT signal")
> Cc: stable@vger.kernel.org
> Reviewed-by: Divya Koppera <Divya.Koppera@microchip.com>
> Signed-off-by: Henry Hu <huhai@kylinos.cn>
Reviewed-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Thanks,
Xuanqiang
next prev parent reply other threads:[~2026-09-03 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 11:30 [PATCH net v2] net: phy: microchip_t1: fix NULL pointer dereference in lan887x_phy_init() huhai
2026-09-03 12:13 ` Xuanqiang Luo [this message]
2026-09-08 0:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2c641835-006b-4511-b273-c2956d474801@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=15815827059@163.com \
--cc=andrew@lunn.ch \
--cc=divya.koppera@microchip.com \
--cc=huhai@kylinos.cn \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).