Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp695140pxb; Tue, 5 Apr 2022 19:07:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1SgtNpnpFdgMiQJeNHqmzyeb8b+pVIPYbcOU0mGL7q9J1PZKqzG/2W9PJ6kRF9BdsxOVS X-Received: by 2002:a65:6753:0:b0:385:fa8a:188f with SMTP id c19-20020a656753000000b00385fa8a188fmr5257625pgu.499.1649210832690; Tue, 05 Apr 2022 19:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210832; cv=none; d=google.com; s=arc-20160816; b=ed3a8XoOoIipeOPxhGiHnCg3CPdTVD7V/ElNksOkeuFSUst/p0bJT2yW4ELEhfs9bj ehme94C3ty2NGqZDY8jnFBRutUuRs5xllO9TP9y5jTTjIjX6je3EP+8BW3OltboORN1/ VeEysi3OHnGtEjSz8mkjBLcCZ3dJj1mkwy+FQJwydAVlZAahPgmFqRhiI9fzMKM17mf8 dugVX1Dp9bspZ7azzyvAyXI3qwYHKdX6aa4VkTycCz4oQgznYtZya+oM5A/vSlXIZUzb sPD1uKudmM05ICNYoKCIDqjDC4F44L+V3vYpCboEXryXORRYFcKsRYZT1OHUrYaoChkU /egA== 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=AWUPc50SpmbuGvj+HOD4XEH0Foz0bXZ3txy2gfOb3qU=; b=QGYY4gh0sU4zDwtXaWfVSuXgoTQgHi9Bs4MqIsZUNy7tVwV2MJU7v9AX5BcyUazj7Q 7PPuve1PZbaVN1/EdOzey0O/+FBBZUtkfDXyk8eb2QLXGXHkQJT+wOq6HnUcSO1GTPtS doJmJkA6417Ql/nykRay4sQH2NkXWo7L2WyihacH0dnxU0/rFKLo90PPcl4nifnrAOM5 sV9PNhaqfM6TW419b74/RVrWMPcdrgjPZ479LP0/jVaMomn6KcUKgUiKiCetlO0jMBwk imjogcgPNHQ5XWr2aOwloiJbYlnGB5wgCcL8tGawGH43W/nCkWgDfCcf/zw6/4fQzAYW WIow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ul29jkoz; 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 h24-20020a170902ac9800b00156849c4f32si10207569plr.84.2022.04.05.19.06.57; Tue, 05 Apr 2022 19:07:12 -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=ul29jkoz; 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 S1377662AbiDELaG (ORCPT + 99 others); Tue, 5 Apr 2022 07:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243925AbiDEIvT (ORCPT ); Tue, 5 Apr 2022 04:51:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA04ECFB8C; Tue, 5 Apr 2022 01:40:03 -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 E3231B81C77; Tue, 5 Apr 2022 08:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3360CC385A3; Tue, 5 Apr 2022 08:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147974; bh=T2hstRTN2DoQMvevAT+LYxm/af106Jsj9SpEV7aDvFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ul29jkozTSHGzKSyGsUkDYi4uE1IvuvQGJfdUhVZ5aGK2Aahptl5EHI3KtvcyJrub RKzmii2P5BODquQ84EQPxdKxoS314zbELHd5z8Uni/fxnq9oObl4BP5GeeCKH5RkNG hWKujFXm6MLSwN+P9MkKwKStSohzwM7K9/0d4AbU= 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 5.16 0152/1017] video: fbdev: atari: Atari 2 bpp (STe) palette bugfix Date: Tue, 5 Apr 2022 09:17:45 +0200 Message-Id: <20220405070358.721540908@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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 @@ -1683,9 +1683,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)); @@ -1971,9 +1971,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) |