From: Marco Chiappero <marco@absence.it>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: platform-driver-x86@vger.kernel.org, Mattia Dongili <malattia@linux.it>
Subject: [PATCH] sony-laptop: fix potential improper handle usage
Date: Wed, 08 Jun 2011 20:49:04 +0200 [thread overview]
Message-ID: <4DEFC420.4040201@absence.it> (raw)
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++) {
reply other threads:[~2011-06-08 18:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DEFC420.4040201@absence.it \
--to=marco@absence.it \
--cc=malattia@linux.it \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.