Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons Fixed wrong cast and invalid array access in ...



details:   https://anonhg.NetBSD.org/src/rev/79e135716018
branches:  trunk
changeset: 327686:79e135716018
user:      khorben <khorben%NetBSD.org@localhost>
date:      Fri Mar 14 05:03:19 2014 +0000

description:
Fixed wrong cast and invalid array access in the calibration framework, as
documented in PR kern/45872. The AA() macro accessed sample coordinates as
long integers, whereas they are really stored as signed integers.

Fixes calibration on my Wetab device.

diffstat:

 sys/dev/wscons/mra.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 30b6733bf24a -r 79e135716018 sys/dev/wscons/mra.c
--- a/sys/dev/wscons/mra.c      Fri Mar 14 01:18:39 2014 +0000
+++ b/sys/dev/wscons/mra.c      Fri Mar 14 05:03:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $   */
+/*     $NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $  */
 
 /*
  * Copyright (c) 1999 Shin Takemura All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,7 +55,7 @@
 //     int64_t SYY;
        int64_t S1Y, S2Y;
        int64_t A, B, C, M;
-#define AA(p, s, i)    (*((const long *)(((const char *)(p)) + (s) * (i))))
+#define AA(p, s, i)    (*((const int *)(((const char *)(p)) + (s) * (i))))
 #define X1(i)          AA(x1, x1s, i)
 #define X2(i)          AA(x2, x2s, i)
 #define Y(i)           AA(y, ys, i)



Home | Main Index | Thread Index | Old Index