All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 4/4] sony-laptop: potential null dereference
@ 2011-02-26 12:56 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2011-02-26 12:56 UTC (permalink / raw)
  To: Mattia Dongili; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

In the original code, if "device_enum" was NULL then it would
dereference it when it printed the error message.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 0db9049..c24aa4a 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1311,7 +1311,11 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
 	}
 
 	device_enum = (union acpi_object *) buffer.pointer;
-	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
+	if (!device_enum) {
+		pr_err(DRV_PFX "Invalid SN06 return object.");
+		goto out_no_enum;
+	}
+	if (device_enum->type != ACPI_TYPE_BUFFER) {
 		pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
 				device_enum->type);
 		goto out_no_enum;

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

end of thread, other threads:[~2011-02-27 21:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 12:56 [patch 4/4] sony-laptop: potential null dereference Dan Carpenter
2011-02-26 12:56 ` Dan Carpenter
2011-02-27 12:20 ` Mattia Dongili
2011-02-27 12:20   ` Mattia Dongili
2011-02-27 14:13   ` [patch 4/4 v2] " Dan Carpenter
2011-02-27 14:13     ` Dan Carpenter
2011-02-27 21:06     ` Mattia Dongili
2011-02-27 21:06       ` Mattia Dongili

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.