lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f0e879e4-745c-4b33-b60e-15973cf9c42e@solid-run.com>
Date: Mon, 15 Apr 2024 08:01:22 +0000
From: Josua Mayer <josua@...id-run.com>
To: Andrew Lunn <andrew@...n.ch>
CC: Florian Fainelli <f.fainelli@...il.com>, Vladimir Oltean
	<olteanv@...il.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Mor Nagli
	<mor.nagli@...id-run.com>
Subject: Re: [PATCH net-next v2] net: dsa: mv88e6xxx: control mdio bus-id
 truncation for long paths

Am 04.04.24 um 16:29 schrieb Andrew Lunn:
>> +	} else if (err >= MII_BUS_ID_SIZE) {
>> +		/* If generated bus id is truncated, names in sysfs
>> +		 * may collide. Insert a special numeric suffix to mark
>> +		 * truncation and avoid name collisions.
>> +		 */
>> +		err = snprintf(NULL, 0, "...!-%d", trunc);
>> +		if (err < 0)
>> +			return err;
> It took me a while to figure out what this was doing. Rather than err,
> maybe add a new variable postfix_len, to give a clue that this is used
> to determine how long the post fix is, and so how much needs to be
> truncated from the end of the string to make room for it.
I considered adding a new variable (e.g. busid_len) to capture all results
from snprintf calls. But it is confusing because in some calls it is
length of parts of bus-id only.

Maybe just using a new variable "len" for all snprintf can be readable?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ