Skip to contentSkip to conversation

cr_backlight_probe allocates too little storage for struct cr_panel

PATCH New Jesper Juhl 1 participant 1 message Jul 18, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cr_backlight_probe allocates too little storage for struct cr_panel

Hi,

The Coverity checker noticed that we allocate too little storage for "struct cr_panel *crp" in cr_backlight_probe().
We allocate sizeof(crp) where we should really be allocating sizeof(*crp) - or sizeof(struct cr_panel) - I chose the first notation.
This patch should fix the problem.

---

 drivers/video/backlight/cr_bllcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/backlight/cr_bllcd.c +1 -1
index e9bbc34..1b3f658 100644
@@ -174,7 +174,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
 	struct cr_panel *crp;
 	u8 dev_en;
 
-	crp = kzalloc(sizeof(crp), GFP_KERNEL);
+	crp = kzalloc(sizeof(*crp), GFP_KERNEL);
 	if (crp == NULL)
 		return -ENOMEM;