[PATCH] pnp: extend char array field in pnp_fixup structure

From: Masatake YAMATO
Date: Wed Apr 03 2013 - 13:56:41 EST


The length of id field of pnp_fixup structure is 7:

struct pnp_fixup {
char id[7];
void (*quirk_function) (struct pnp_dev * dev); /* fixup function */
}

In other hand the field is initialized with a constant cstring
consisting of 7 characters in pnp_fixups defined in drivers/pnp/quirks.c:

static struct pnp_fixup pnp_fixups[] = {
/* Soundblaster awe io port quirk */
{"CTL0021", quirk_awe32_resources},
{"CTL0022", quirk_awe32_resources},

The constant cstring is too large to store; no space for nul char.

If the id field is just used as byte array, there is no problem.
However, it is used as c string in pnp_fixup_device function:

pnp_dbg(&dev->dev, "%s: calling %pF\n", f->id,
f->quirk_function);

Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>
---
include/linux/pnp.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 195aafc..d734ee2 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -295,7 +295,7 @@ static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data)
}

struct pnp_fixup {
- char id[7];
+ char id[8];
void (*quirk_function) (struct pnp_dev * dev); /* fixup function */
};

--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/