lkml.org 
[lkml]   [2013]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] pnp: extend char array field in pnp_fixup structure
From
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@redhat.com>
---
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


\
 
 \ /
  Last update: 2013-04-03 20:41    [W:0.025 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site