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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230703135211.87416-3-andriy.shevchenko@linux.intel.com>
Date:   Mon,  3 Jul 2023 16:52:09 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>, Mark Brown <broonie@...nel.org>,
        David Lin <CTLIN0@...oton.com>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
        alsa-devel@...a-project.org
Cc:     Jonathan Corbet <corbet@....net>, Antti Palosaari <crope@....fi>,
        Sergey Kozlov <serjk@...up.ru>, Abylay Ospan <aospan@...up.ru>,
        Yasunari Takiguchi <Yasunari.Takiguchi@...y.com>,
        Michael Krufky <mkrufky@...uxtv.org>,
        Matthias Schwarzott <zzam@...too.org>,
        Akihiro Tsukada <tskd08@...il.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Subject: [PATCH v2 2/4] lib/math/int_log: Use ARRAY_SIZE(logtable) where makes sense

Use ARRAY_SIZE(logtable) where makes sense.

Reviewed-by: Mauro Carvalho Chehab <mchehab@...nel.org>
Acked-by: Mauro Carvalho Chehab <mchehab@...nel.org>
Link: https://lore.kernel.org/r/20230619172019.21457-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 lib/math/int_log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/math/int_log.c b/lib/math/int_log.c
index 322df25a22d6..ea98fc0b3fe2 100644
--- a/lib/math/int_log.c
+++ b/lib/math/int_log.c
@@ -91,7 +91,7 @@ unsigned int intlog2(u32 value)
 	 *	so we would use the entry 0x18
 	 */
 	significand = value << (31 - msb);
-	logentry = (significand >> 23) & 0xff;
+	logentry = (significand >> 23) % ARRAY_SIZE(logtable);
 
 	/**
 	 *	last step we do is interpolation because of the
@@ -109,7 +109,7 @@ unsigned int intlog2(u32 value)
 	 *	logtable_next is 256
 	 */
 	interpolation = ((significand & 0x7fffff) *
-			((logtable[(logentry + 1) & 0xff] -
+			((logtable[(logentry + 1) % ARRAY_SIZE(logtable)] -
 			  logtable[logentry]) & 0xffff)) >> 15;
 
 	/* now we return the result */
-- 
2.40.0.1.gaa8946217a0b

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ