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>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0805111450350.29620@ask.diku.dk>
Date:	Sun, 11 May 2008 14:51:04 +0200 (CEST)
From:	Julia Lawall <julia@...u.dk>
To:	perex@...ex.cz, ricardo@...rybox.net, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [PATCH 2/4] sound/oss: use unsigned for loop index

From: Julia Lawall <julia@...u.dk>

A few more cases in the spirit of the patch "Trivial: Replacement of always
>0 ints with unsigned ints" submitted by Ricardo Martins <ricardo@...rybox.net>

The transformation was made using the following semantic patch
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@ // find anything that might decrement the variable
identifier i;
expression E;
position p;
@@

  int i@p;
  ...
(
  &i
|
  i--
|
  --i
|
  i-=E
|
  i+=E
)

@x disable decl_init@
identifier r.i;
expression E;
position p1 != r.p;
@@

(
  volatile int i = 0;
|
  volatile int i;
|
+ unsigned
  int i@p1 = 0;
|
+ unsigned
  int i@p1;
)
  <... when != i = E      
(
  i = 0
|
  i = 1
)
  ...>
// </smpl>

Signed-off-by: Julia Lawall <julia@...u.dk>

---

 sound/oss/dmasound/dmasound_core.c |    2 +-
 sound/oss/msnd.c                   |    4 ++--
 sound/oss/sb_common.c              |    6 +++---
 sound/oss/waveartist.c             |    4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff -u -p a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
--- a/sound/oss/dmasound/dmasound_core.c 2008-04-07 13:50:28.000000000 +0200
+++ b/sound/oss/dmasound/dmasound_core.c 2008-05-11 12:19:29.000000000 +0200
@@ -423,7 +423,7 @@ static int sq_allocate_buffers(struct so
 
 static void sq_release_buffers(struct sound_queue *sq)
 {
-	int i;
+	unsigned int i;
 
 	if (sq->buffers) {
 		for (i = 0; i < sq->numBufs; i++)
diff -u -p a/sound/oss/msnd.c b/sound/oss/msnd.c
--- a/sound/oss/msnd.c 2008-04-07 13:50:28.000000000 +0200
+++ b/sound/oss/msnd.c 2008-05-11 12:19:27.000000000 +0200
@@ -49,7 +49,7 @@ static int			num_devs;
 
 int msnd_register(multisound_dev_t *dev)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < MSND_MAX_DEVS; ++i)
 		if (devs[i] == NULL)
@@ -65,7 +65,7 @@ int msnd_register(multisound_dev_t *dev)
 
 void msnd_unregister(multisound_dev_t *dev)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < MSND_MAX_DEVS; ++i)
 		if (devs[i] == dev)
diff -u -p a/sound/oss/sb_common.c b/sound/oss/sb_common.c
--- a/sound/oss/sb_common.c 2008-04-16 13:28:05.000000000 +0200
+++ b/sound/oss/sb_common.c 2008-05-11 12:19:36.000000000 +0200
@@ -84,7 +84,7 @@ static sb_devc *last_sb;		/* Last sb loa
 
 int sb_dsp_command(sb_devc * devc, unsigned char val)
 {
-	int i;
+	unsigned int i;
 	unsigned long limit;
 
 	limit = jiffies + HZ / 10;	/* Timeout */
@@ -600,7 +600,7 @@ int sb_dsp_detect(struct address_info *h
 			if (sb_dsp_command(devc, 0x09))
 				if (sb_dsp_command(devc, 0x00))	/* Enter WSS mode */
 				{
-					int i;
+					unsigned int i;
 
 					/* Have some delay */
 					for (i = 0; i < 10000; i++)
@@ -1009,7 +1009,7 @@ static int smw_midi_init(sb_devc * devc,
 {
 	int mpu_base = hw_config->io_base;
 	int mp_base = mpu_base + 4;		/* Microcontroller base */
-	int i;
+	unsigned int i;
 	unsigned char control;
 
 
diff -u -p a/sound/oss/waveartist.c b/sound/oss/waveartist.c
--- a/sound/oss/waveartist.c 2008-04-16 13:28:05.000000000 +0200
+++ b/sound/oss/waveartist.c 2008-05-11 12:19:27.000000000 +0200
@@ -1212,7 +1212,7 @@ static struct mixer_operations waveartis
 static void
 waveartist_mixer_reset(wavnc_info *devc)
 {
-	int i;
+	unsigned int i;
 
 	if (debug_flg & DEBUG_MIXER)
 		printk("%s: mixer_reset\n", devc->hw.name);
@@ -1417,7 +1417,7 @@ attach_waveartist(struct address_info *h
 static void __exit unload_waveartist(struct address_info *hw)
 {
 	wavnc_info *devc = NULL;
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < nr_waveartist_devs; i++)
 		if (hw->io_base == adev_info[i].hw.io_base) {
--
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