* [PATCH] Input: psmouse - fix attribute access on 64-bit systems
@ 2006-11-07 17:02 Sergey Vlasov
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Vlasov @ 2006-11-07 17:02 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, stable, Sergey Vlasov
psmouse_show_int_attr() and psmouse_set_int_attr() were accessing
unsigned int fields as unsigned long, which gave garbage on x86_64.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---
drivers/input/mouse/psmouse-base.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
The problem was found in 2.6.18.2; the same patch applies to the
current tree.
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 343afa3..07b0604 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1332,20 +1332,22 @@ ssize_t psmouse_attr_set_helper(struct d
static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char *buf)
{
- unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
+ unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
- return sprintf(buf, "%lu\n", *field);
+ return sprintf(buf, "%u\n", *field);
}
static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count)
{
- unsigned long *field = (unsigned long *)((char *)psmouse + (size_t)offset);
+ unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
unsigned long value;
char *rest;
value = simple_strtoul(buf, &rest, 10);
if (*rest)
return -EINVAL;
+ if ((unsigned int)value != value)
+ return -EINVAL;
*field = value;
--
1.4.3.3.gddcc6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: psmouse - fix attribute access on 64-bit systems
[not found] <11629116333762-git-send-email-vsu@altlinux.ru>
@ 2006-11-08 20:44 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2006-11-08 20:44 UTC (permalink / raw)
To: Sergey Vlasov; +Cc: linux-input, linux-kernel, stable
On 11/7/06, Sergey Vlasov <vsu@altlinux.ru> wrote:
> psmouse_show_int_attr() and psmouse_set_int_attr() were accessing
> unsigned int fields as unsigned long, which gave garbage on x86_64.
>
> Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Will apply, thank you Sergey.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-08 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-07 17:02 [PATCH] Input: psmouse - fix attribute access on 64-bit systems Sergey Vlasov
[not found] <11629116333762-git-send-email-vsu@altlinux.ru>
2006-11-08 20:44 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox