From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-37.mta0.migadu.com [91.218.175.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FEB937105A for ; Thu, 3 Sep 2026 12:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788437622; cv=none; b=ryFx/bVw/jVC2kgiPmJy0q0bG5N8ZRaIKmd+F6MHUYh+pMz3SzHQt6A/ag+VKAK68eNd9ok7yosdI+PuTTO4LWQMfthAIfu9ElWzyIB6Ye2sPzLyTAnW3EkFxvG33qpYsPgob1J1vDyM/YMrPGrSQP2yM1JQYBWrp23tEgcZm9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788437622; c=relaxed/simple; bh=u2BFG2Z5cG1xeYDegTmCmVgyYBL5mku0nB+ZYzycQTM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jcceNb18bHMcjiEuA6ezoWCUZ//bTVxRdcdw6DqPGJvamLf7sO91LQ+FyrM8MXp7/fPSbJ4dh9bToYoZv7bfbVHAtZ7+fR2Tp/cnTFO+NLPiui8T+oVTDdNJAr1LbKzgpsIq33TtYUA5FCHnSJKs6VYJ7q2uyA0ig9JXflwuMgQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=JvSiyp3M; arc=none smtp.client-ip=91.218.175.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JvSiyp3M" X-Envelope-To: netdev@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=u2BFG2Z5cG1xeYDegTmCmVgyYBL5mku0nB+ZYzycQTM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788437617; v=1; x=1789042417; b=JvSiyp3MSnSn5dV4jP9fyRrkgGqImBhjXWuXlGgSsPFbuwhsUMDJ9dXw2HiGtozycNRrs3VH VeGEtGUZzPbrMmrjMJ8FJbzkYrYz+ZkK/nwr2168RhPuhxhcUSa33l2FD7HkFZKZemW/T6GoEtw 4TZbHcCXqspOq/riwzHuhn9c= X-Envelope-To: netdev@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 41e320479a75f80d; Thu, 03 Sep 2026 12:13:37 +0000 X-Mizu-Trace-ID: 41e320479a75f80d X-Migadu-Flow: FLOW_OUT Message-ID: <2c641835-006b-4511-b273-c2956d474801@linux.dev> Date: Thu, 3 Sep 2026 20:13:29 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2] net: phy: microchip_t1: fix NULL pointer dereference in lan887x_phy_init() To: huhai <15815827059@163.com> Cc: netdev@vger.kernel.org, Henry Hu , stable@vger.kernel.org, kuba@kernel.org, andrew@lunn.ch, divya.koppera@microchip.com References: <20260903113046.163630-1-15815827059@163.com> From: Xuanqiang Luo In-Reply-To: <20260903113046.163630-1-15815827059@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2026/9/3 19:30, huhai 写道: > From: Henry Hu > > 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 > Signed-off-by: Henry Hu Reviewed-by: Xuanqiang Luo Thanks, Xuanqiang