All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pnp: extend char array field in pnp_fixup structure
@ 2013-04-03 17:56 Masatake YAMATO
  0 siblings, 0 replies; only message in thread
From: Masatake YAMATO @ 2013-04-03 17:56 UTC (permalink / raw)
  To: linux-kernel

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


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

only message in thread, other threads:[~2013-04-03 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 17:56 [PATCH] pnp: extend char array field in pnp_fixup structure Masatake YAMATO

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.