[PATCH] fbcon: incorrect use of "&&" instead of "&"

From: Willy Tarreau
Date: Sat Nov 25 2006 - 15:54:10 EST


The use of "&&" in the following statement causes unexpected
cases to be matched since __SCROLL_YMASK = 0x0f :

switch (p->scrollmode && __SCROLL_YMASK)
case __SCROLL_YWRAP: ... /* 0x02 */
case __SCROLL_YPAN: ... /* 0x01 */

The YWRAP case can never be matched and the YPAN case may be
matched by mistake. Obvious fix is to replace && with &. This
bug is not present in 2.6.

Signed-off-by: Willy Tarreau <w@xxxxxx>
---
drivers/video/fbcon.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/fbcon.c b/drivers/video/fbcon.c
index 0fb40c5..1f66819 100644
--- a/drivers/video/fbcon.c
+++ b/drivers/video/fbcon.c
@@ -2102,7 +2102,7 @@ static int fbcon_scrolldelta(struct vc_d

offset = p->yscroll-scrollback_current;
limit = p->vrows;
- switch (p->scrollmode && __SCROLL_YMASK) {
+ switch (p->scrollmode & __SCROLL_YMASK) {
case __SCROLL_YWRAP:
p->var.vmode |= FB_VMODE_YWRAP;
break;
--
1.4.2.4

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/