All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sony-laptop: fix potential improper handle usage
@ 2011-06-08 18:49 Marco Chiappero
  0 siblings, 0 replies; only message in thread
From: Marco Chiappero @ 2011-06-08 18:49 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mattia Dongili

SNC handles are positive numbers, all handles are valid with the sole 
exception of handle 0x0. This patch fixes sony_find_snc_handle, now 
using unsigned int for the handle variable and returning -1 when 
argument its value is 0x0.


Signed-off-by: Marco Chiappero <marco@absence.it>
---

--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -811,12 +811,12 @@ static int sony_nc_handles_cleanup(struc
  	return 0;
  }

-static int sony_find_snc_handle(int handle)
+static int sony_find_snc_handle(unsigned int handle)
  {
  	int i;

-	/* not initialized yet, return early */
-	if (!handles)
+	/* not initialized yet or invalid handle, return early */
+	if (!handles || !handle)
  		return -1;

  	for (i = 0; i < 0x10; i++) {

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

only message in thread, other threads:[~2011-06-08 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 18:49 [PATCH] sony-laptop: fix potential improper handle usage Marco Chiappero

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.