From dc30a436903ccf180b0313d3fc3f44278a1d44c8 Mon Sep 17 00:00:00 2001 From: Asim Kadav Date: Thu, 3 Jan 2013 11:47:26 -0600 Subject: [PATCH] sound: oss/pas2: Fix possible access out of array Added a fix for hardware dependence bug where a sound card failure should not result in reading beyond array memory index. Signed-off-by: Asim Kadav Signed-off-by: Takashi Iwai --- sound/oss/pas2_card.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c index dabf8a871dcc..7004e24d209f 100644 --- a/sound/oss/pas2_card.c +++ b/sound/oss/pas2_card.c @@ -333,6 +333,11 @@ static void __init attach_pas_card(struct address_info *hw_config) { char temp[100]; + if (pas_model < 0 || + pas_model >= ARRAY_SIZE(pas_model_names)) { + printk(KERN_ERR "pas2 unrecognized model.\n"); + return; + } sprintf(temp, "%s rev %d", pas_model_names[(int) pas_model], pas_read(0x2789));