linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: sm7xxfb: copy name of the device before calling smtc_alloc_fb_info
@ 2012-08-04 17:25 Devendra Naga
  2012-08-14  2:30 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2012-08-04 17:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Javier Muñoz, Paul Gortmaker,
	Devendra Naga, devel, linux-kernel
  Cc: Devendra Naga

as we do a strcpy(smdrv_ptr->fb_struct->fix->id, name), and the name here in
sm7xxx_probe is not having any assignment, and which leads to copying of the garbage value
into the id field of the fix struct of fb interface struct. fix it by copying the name before
calling alloc_fbinfo.

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
---

Changes since V1:
 Fix a null deref when smtc_alloc_fbinfo fails, this was added by me in V1.

 drivers/staging/sm7xxfb/sm7xxfb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 1c1780c..1e42444 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -798,6 +798,8 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 	if (err)
 		return err;
 
+	sprintf(name, "sm%Xfb", ent->device);
+
 	sfb = smtc_alloc_fb_info(pdev, name);
 
 	if (!sfb) {
@@ -806,8 +808,6 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 	}
 
 	sfb->chip_id = ent->device;
-	sprintf(name, "sm%Xfb", sfb->chip_id);
-
 	pci_set_drvdata(pdev, sfb);
 
 	sm7xx_init_hw();
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-14  2:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-04 17:25 [PATCH V2] staging: sm7xxfb: copy name of the device before calling smtc_alloc_fb_info Devendra Naga
2012-08-14  2:30 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).