🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22520

Re: [PATCH] net: usb: mcs7830: skip zero-length register dump reads

#22520
From: Andrew Lunn
Date: Wed, 25 Nov 2026 13:54
17 lines
8757 bytes
On Wed, Nov 25, 2026 at 03:16:49PM +0800, YuanZhe Liu wrote:
> mcs7830_get_regs() passes the user-supplied regs->len straight to
> mcs7830_get_reg(), which submits a vendor control-IN request for that
> many bytes.  ETHTOOL_GREGS accepts a zero length, and ethtool_get_regs()
> still invokes the driver's get_regs() callback in that case, so a
> zero-byte dump request reaches the driver.

Take a step back. Think about the kAPI. Why pass 0?

I think you are solving the problem in the wrong place. And you are
playing whack-a-mole when there is no need.

    Andrew

---
pw-bot: cr
Technical Details
Message-ID: <7b103b24-51f6-4724-96ad-fe9b3d54831d@lunn.ch>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371356-linux-kernel-netdev=dewy.ru
References: <20261125071649.7052-1-25031212351@stu.xidian.edu.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371356-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] net: usb: mcs7830: skip zero-length register dump reads
Date: Wed, 25 Nov 2026 14:54:29 +0100
Organization: Usenet Network
Message-ID: <7b103b24-51f6-4724-96ad-fe9b3d54831d@lunn.ch>
References: <20261125071649.7052-1-25031212351@stu.xidian.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="220031"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uYuX7/K98w+2qhXvdSgv7dhiTok= sha256:PNf7gysPl12Rv+M0ATKbFBU9jiikzToQK5AZ31vyiCc=
	sha1:YRc0pd/OELDZEeDFiAEd4bY+8tE= sha256:R7c1EmW1pRKo87obX0HHHQiSRkkGK6xMxgzmYCnW2Ek=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 3B8DC125E6C; Wed, 25 Nov 2026 16:55:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lunn.ch
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id oBk9yc9YjtHK;
	Wed, 25 Nov 2026 16:55:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371356-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 99E8A125E6B; Wed, 25 Nov 2026 16:54:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id A963F34623; Wed, 25 Nov 2026 13:54:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1795614890;
	b=ZeCXQuCmbJHZ4wSt/zHMxpfJM9FQ9XYYtK3PIV25j49IlSzSNbkQOGJcDwACZkxRLN/Q
	 Gzya7BkLRWtIONgFzR/nL3766JrsOgGKQIHuhQ8C/AX2akY7DA33TQTsLkjMsM9QQe/Kl
	 n7Uj+bgdIZonxLa80oO/AhBMEhDaovdsH6ejAy2NI7CIb3THLoggENItyav5vjOxmlsJ+
	 4XNcX9IzPLqYz0qtH03s10WzEJlQmcNIijukyXssdQyliZu0h4O26EBpoNfXQSObxnJk6
	 zR+PRDOH3DFpnIBgp+4brNrkumLDl/I7ZI3MOGlJuVrk3bGhMkpNgm7GlN2+xPLRzgQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795614890;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=tRMOVhjO91YgFyCjVHMcEDWOP+GyvWo/nClKImfdGdg=;
	b=SK+9tGP2O/U4JDb39dz+YfhxyhfZNGQKoReJg7hN/9ejokDR2wn2YgV9Q/Sncnucmlcg
	 ObviQoMZLqw0sDGGotf9MqT3dQPu/Zp/EClJ+roXQPQK8BCb1iep0K923fGTwJabNk399
	 t+1epPCHPyxp22YAupW3ajk0SeTYfEUaCvJVKYNu94hPDWRB1ZOAHkHaOadfkvMpsPJZy
	 3CSvIyg5K7pUfKHkGm9Nq2uHpz4yNDx76QQDEtRoOCZA13x4DiwEAjvBXbQsn+t8FXRuG
	 9SE1MlkbF8nN7YYkqWpXgOxZtvP37z5guq7gcr4sia+DwCkaXiZ3IH3SP5LsqhAxTGw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=i1favunH;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	arc=fail smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9463F606A327;
	Wed, 25 Nov 2026 13:54:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=i1favunH
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795614884;
	b=TZdEpWGyiEzHke7hemk9a0O79edaLXMbnz/AYz6KDI7PlxKw1SuxhssJ4GB0rThvjJ4R
	 vDwYU9Awskcs0ES3I4z0+p7LvIqLcULBEgrLiyxbGM9geGk0Q/Uv9K6UcVk1NOIeIxzdx
	 Zaqs9HRFHxbTjeUB9fbS3lSx3Xx8Qi9k2/bXpBJeS7vDtADs8TJg7lOmZvpzipiBGU1rf
	 +Dzc7YcDAB0PQ+MzmwC3ktOl4YZJ0lv43L8lTXdlNz8+L3NhuMPEwUdDZe0XkdiQBkFpP
	 DeQnOm4Fl0bFwu8FbbNMsFZAfmm0v4wOyf27FKm3oW5RAzyxGyPSnHbSSeBb07Y204g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795614884;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=tRMOVhjO91YgFyCjVHMcEDWOP+GyvWo/nClKImfdGdg=;
	b=R8/SUZ88ssIXAyQQSWkVt+H4lRfefnBt+207MwG9BLBI++5Cnp4KCLtaNIQSWsnRnU9n
	 rceUN+g7UeiNXH1hE8+ozcp7ouvrNurRKCDa/OQZx/NgtcxbDIMsTTqiFELQNxItpxeaH
	 nHpWbuPwYUXnpfXofiY5rTP72nhKUhG0tTSm9UjsymxKrN+G13JpHzqg2WSWQ4WKR3eAo
	 5f39y5Qwpg74z0b2n5ypSO6TN2w7rgwlNVvdH96E7uH3AhdBCtNdJsFIvmfxE5qAQu3Fl
	 sthWSX6JYPRODPw5q/TTvYU/n2sS69ToV8/fIluBJv5hRzMcpArRgltalD+HdcC/8tw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=i1favunH;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0519C606A31E;
	Wed, 25 Nov 2026 13:54:43 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0519C606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-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=tRMOVhjO91YgFyCjVHMcEDWOP+GyvWo/nClKImfdGdg=; b=i1favunHeeOjlEMSLGfU/YnsJ9
	px8jbVsRxoTzvw/THacpoPIm6ZOBTxMRy0zNuJyVenny5Ca40XuomlQ1Hwn4ELxr3zILng8GXHxSG
	XR27I453nvQL/DWPkmg14f2+NoThyNc2ZEv02vQ3lKmXCZiukAfn1aR2VzMLf6rGdw1g=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xWDS9-001KOd-PG; Wed, 25 Nov 2026 14:54:29 +0100
X-Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Bin Yu <byu@xidian.edu.cn>, Cheng Wen <wencheng@xidian.edu.cn>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261125071649.7052-1-25031212351@stu.xidian.edu.cn>