Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3194723pxb; Mon, 18 Apr 2022 18:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtJ+Ri8lOtOWHnrfKHWpsytOLZx6uBG7BxXV12bgxaxcpVlzXPkCu8tyfzzd4QUGk7SBlH X-Received: by 2002:a50:9b5d:0:b0:41d:9252:87f8 with SMTP id a29-20020a509b5d000000b0041d925287f8mr15439804edj.181.1650332853732; Mon, 18 Apr 2022 18:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650332853; cv=none; d=google.com; s=arc-20160816; b=gpsPxxx3XU3ola6OuHM/PTqHeSj/P/l7O7kitISRg158iDEqGxVDwfO4k3DzNhMUR6 V4dDbnspa8td80xAb9294pWe36Wstn5+nc8UGZRJtgIuujm6Hhebbto19sy67QHQhgJL geoN58X0lAqzQv+g0pWKTkhOyJCo6bZAoVAhavxuUB1xXgGnZ1yrGi/BrEpbNVWcdFBS npCG/hlfU70hTkSN5pgzS06zq3OTILfsQL9mKWfnNDd37WPOxjtsEhdMW8XtFGnc8DGZ vzFzjff+YE55aNYdLWnuMzY6GM6tt7Oz6dTsL7zvbk1QpUA5hXZR7o+atfq0pfPh/1FS FcaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fjtM4/d2S7kGa+pxiMb5nfHZGYqaOosGMHAuhv03QIc=; b=atflTbyIOlMTquSvDnSjGIzVTQNoIWl2qpwRsBgm2oIz5su3lVzptFwKktrk7ojOV1 JFexX7x2CG1tmEulbpenOe3tKSJBMVjt0v3aT9bIDcK469UtrEzpCkMGhzcCQIZ57sir S2SU9Z07aF3QepW2MT/CaM9iz6ts+/R7SICDHiBsU8olBoQ+qJenfQqR25ujDtgYmpnh 5T/I9G87VeL6lqFIX7UmLRYyvYpIp9Ng0bLmsiKcbuJopsDTEq9jvaWEJu9brlPr4Uto 63CZ+ho0EXPMSW3AXLtGJvhc2RxqglWzw5Q3jqMIEvXW3TSVclH/n801drlX2b23YM8e tnoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NyaRY2Pw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a170906078100b006e86da92b15si7670521ejc.904.2022.04.18.18.47.07; Mon, 18 Apr 2022 18:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NyaRY2Pw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243016AbiDRNjX (ORCPT + 99 others); Mon, 18 Apr 2022 09:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240391AbiDRNKy (ORCPT ); Mon, 18 Apr 2022 09:10:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666AA39804; Mon, 18 Apr 2022 05:50:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6FD3B80E4B; Mon, 18 Apr 2022 12:50:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7952BC385A7; Mon, 18 Apr 2022 12:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286224; bh=i7d4IMjg68LsHEXJVgI+Q2DYKMuVrFSB7ixi9ScfLgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyaRY2PwjjAv2GaaEEWM4dGghFIMojlKHuSt0JUwn9bQlnHAFbnWG6js8mxuAyVX3 cUI5XayAw1WETRHA/xmjyGG0PiQDM50QQlLp4t6a3ZyGvWSi1CQJIWdCxUPaGR4+np X5im3nvUFaFBK8hradAwRCG2euPeMn9UVQ9nu0C0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Michael Schmitz , Helge Deller Subject: [PATCH 4.14 040/284] video: fbdev: atari: Atari 2 bpp (STe) palette bugfix Date: Mon, 18 Apr 2022 14:10:21 +0200 Message-Id: <20220418121211.834573736@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Schmitz commit c8be5edbd36ceed2ff3d6b8f8e40643c3f396ea3 upstream. The code to set the shifter STe palette registers has a long standing operator precedence bug, manifesting as colors set on a 2 bits per pixel frame buffer coming up with a distinctive blue tint. Add parentheses around the calculation of the per-color palette data before shifting those into their respective bit field position. This bug goes back a long way (2.4 days at the very least) so there won't be a Fixes: tag. Tested on ARAnyM as well on Falcon030 hardware. Cc: stable@vger.kernel.org Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/all/CAMuHMdU3ievhXxKR_xi_v3aumnYW7UNUO6qMdhgfyWTyVSsCkQ@mail.gmail.com Tested-by: Michael Schmitz Tested-by: Geert Uytterhoeven Signed-off-by: Michael Schmitz Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/atafb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -1713,9 +1713,9 @@ static int falcon_setcolreg(unsigned int ((blue & 0xfc00) >> 8)); if (regno < 16) { shifter_tt.color_reg[regno] = - (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) | - (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) | - ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); + ((((red & 0xe000) >> 13) | ((red & 0x1000) >> 12)) << 8) | + ((((green & 0xe000) >> 13) | ((green & 0x1000) >> 12)) << 4) | + ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11)); @@ -2001,9 +2001,9 @@ static int stste_setcolreg(unsigned int green >>= 12; if (ATARIHW_PRESENT(EXTD_SHIFTER)) shifter_tt.color_reg[regno] = - (((red & 0xe) >> 1) | ((red & 1) << 3) << 8) | - (((green & 0xe) >> 1) | ((green & 1) << 3) << 4) | - ((blue & 0xe) >> 1) | ((blue & 1) << 3); + ((((red & 0xe) >> 1) | ((red & 1) << 3)) << 8) | + ((((green & 0xe) >> 1) | ((green & 1) << 3)) << 4) | + ((blue & 0xe) >> 1) | ((blue & 1) << 3); else shifter_tt.color_reg[regno] = ((red & 0xe) << 7) |