public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix Oops with ALSA OSS emulation on PPC (2.6.10-rc3)
@ 2004-12-22 18:35 Takashi Iwai
  0 siblings, 0 replies; only message in thread
From: Takashi Iwai @ 2004-12-22 18:35 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, perex, benh, linux-kernel

Hi,

Ben finally found out the cause of Oops happening on ALSA OSS
emulation with powermac driver.  It's because of the sign of char.

The patch is simple as attached below.
Could you apply it to 2.6.10?


thanks,

--
Takashi Iwai <tiwai@suse.de>		ALSA Developer - www.alsa-project.org

====

Summary: [ALSA] Fix Oops with ALSA OSS emulation on PPC

Fix suggested by Benjamin Herrenschmidt <benh@kernel.crashing.org>

On architectures like PPC, char is handled as "unsigned char", thus the
pcm_format_data table entries with -1 give a positive 255.  This results
in Oops with OSS-emulation on such architectures.

The patch simply adds the right signed/unsigned prefix to fix this problem.


Signed-off-by: Takashi Iwai <tiwai@suse.de>


--- linux/sound/core/pcm_misc.c	8 Jun 2004 16:57:28 -0000	1.12
+++ linux/sound/core/pcm_misc.c	22 Dec 2004 18:07:29 -0000	1.14
@@ -25,11 +25,14 @@
 #include <sound/pcm.h>
 #define SND_PCM_FORMAT_UNKNOWN (-1)
 
+/* NOTE: "signed" prefix must be given below since the default char is
+ *       unsigned on some architectures!
+ */
 struct pcm_format_data {
-	char width;	/* bit width */
-	char phys;	/* physical bit width */
-	char le;	/* 0 = big-endian, 1 = little-endian, -1 = others */
-	char signd;	/* 0 = unsigned, 1 = signed, -1 = others */
+	unsigned char width;	/* bit width */
+	unsigned char phys;	/* physical bit width */
+	signed char le;	/* 0 = big-endian, 1 = little-endian, -1 = others */
+	signed char signd;	/* 0 = unsigned, 1 = signed, -1 = others */
 	unsigned char silence[8];	/* silence data to fill */
 };
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-22 18:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-22 18:35 [PATCH] Fix Oops with ALSA OSS emulation on PPC (2.6.10-rc3) Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox