Module Name:    src
Committed By:   khorben
Date:           Fri Mar 14 05:03:19 UTC 2014

Modified Files:
        src/sys/dev/wscons: mra.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/mra.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/mra.c
diff -u src/sys/dev/wscons/mra.c:1.5 src/sys/dev/wscons/mra.c:1.6
--- src/sys/dev/wscons/mra.c:1.5	Sat Sep 14 21:06:50 2013
+++ src/sys/dev/wscons/mra.c	Fri Mar 14 05:03:19 2014
@@ -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 @@ mra_Y_AX1_BX2_C(const int *y, int ys,
 //	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)

Reply via email to