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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Nov 2007 19:19:30 +0100
From:	Roel Kluin <12o3l@...cali.nl>
To:	lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH?] OSS: fix operator precedence in return of btaudio_dsp_ioctl

First of all, is /sound/oss/* still maintained?

#define HWBASE_AD (448000)
...
with if(bta->analog) evaluating to true bta->decimation may range
from 15 to 5
...
HWBASE_AD*4/bta->decimation>>bta->sampleshift

which is equivalent to 

((HWBASE_AD * 4)/bta->decimation) >> bta->sampleshift

actually may evaluate to something like:

(1792000 / 15 ) >> bta->sampleshift

Isn't intended (HWBASE_AD * 4)/(bta->decimation >> bta->sampleshift)?
Then consider the patch below.
--
Fix operator precedence in return

Signed-off-by: Roel Kluin <12o3l@...cali.nl>
---
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index 4d5cf05..2a5cace 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -661,7 +661,8 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct file *file,
 		/* fall through */
         case SOUND_PCM_READ_RATE:
 		if (bta->analog) {
-			return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, p);
+			return put_user((HWBASE_AD * 4) /
+				(bta->decimation >> bta->sampleshift), p);
 		} else {
 			return put_user(bta->rate, p);
 		}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ