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-next>] [day] [month] [year] [list]
Date:	Sun, 22 Sep 2013 02:36:42 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	netdev <netdev@...r.kernel.org>,
	Aurelien Guillaume <aurelien@....me>
Subject: [PATCH ethtool] Fix iteration count in sff8472_calibration()

We want to iterate over all elements of the various arrays of readings
(which all have the same dimensions - and maybe ought to be a single
array).  Unfortunately the iteration count is sizeof(sd->bias_cur) and
bias_cur has 2-byte elements, so we iterate over twice as many
elements as are really there.

Compiler-detected, and compile-tested only.

Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
 sfpdiag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sfpdiag.c b/sfpdiag.c
index f67e491..04fd880 100644
--- a/sfpdiag.c
+++ b/sfpdiag.c
@@ -224,7 +224,7 @@ static void sff8472_calibration(const __u8 *id, struct sff8472_diags *sd)
 	__u16 rx_reading;
 
 	/* Calibration should occur for all values (threshold and current) */
-	for (i = 0; i < sizeof(sd->bias_cur); ++i) {
+	for (i = 0; i < ARRAY_SIZE(sd->bias_cur); ++i) {
 		/*
 		 * Apply calibration formula 1 (Temp., Voltage, Bias, Tx Power)
 		 */


Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ