summaryrefslogtreecommitdiff
path: root/hald
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-02-25 02:25:18 -0800
committerMartin Pitt <martin.pitt@ubuntu.com>2010-03-04 00:41:51 +0100
commit597c1ffffd61a15a334ce42f2a569c59f0270bcb (patch)
tree7ae2d93994637907be4f4471ce890b733c487f97 /hald
parentbaa61a879985d63f549854518ef14efd40e62e8c (diff)
Fix incorrect arguments to ioperm() call
The second argument of ioperm() is not the last port to be accessed but rather length of the port range [port, port + len). Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Diffstat (limited to 'hald')
-rw-r--r--hald/linux/addons/addon-imac-backlight.c3
-rw-r--r--hald/linux/addons/addon-macbookpro-backlight.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/hald/linux/addons/addon-imac-backlight.c b/hald/linux/addons/addon-imac-backlight.c
index e8691929..54e4ea34 100644
--- a/hald/linux/addons/addon-imac-backlight.c
+++ b/hald/linux/addons/addon-imac-backlight.c
@@ -158,7 +158,8 @@ main (int argc, char **argv)
goto out;
}
- if (ioperm(0xB2, 0xB3, 1) < 0)
+ /* Allow access to ports 0xB2 and 0xB3 */
+ if (ioperm(0xB2, 2, 1) < 0)
{
HAL_ERROR (("ioperm failed (you should be root)."));
exit(1);
diff --git a/hald/linux/addons/addon-macbookpro-backlight.c b/hald/linux/addons/addon-macbookpro-backlight.c
index 2a6fef6f..c1bbbac1 100644
--- a/hald/linux/addons/addon-macbookpro-backlight.c
+++ b/hald/linux/addons/addon-macbookpro-backlight.c
@@ -507,7 +507,8 @@ main (int argc, char *argv[])
state = INREG(0x7ae4);
OUTREG(0x7ae4, state);
- if (ioperm (0x300, 0x304, 1) < 0) {
+ /* Allow access to porta 0x300 through 0x304 */
+ if (ioperm (0x300, 5, 1) < 0) {
HAL_ERROR (("ioperm failed (you should be root)."));
exit(1);
}