Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp675988pxb; Tue, 5 Apr 2022 18:19:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2+i4/OoZ6AAa/Sj1rRb0N6Mzi0YQYsSYu7BlddCPERNp0zAHNB6Czn96hhLWv++7uQTNz X-Received: by 2002:a17:907:7286:b0:6df:f778:2585 with SMTP id dt6-20020a170907728600b006dff7782585mr5787123ejc.244.1649207952095; Tue, 05 Apr 2022 18:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649207952; cv=none; d=google.com; s=arc-20160816; b=vefShKpcwVa447zbTXRT4lrWHaavJgx3FtOyMZIDMgY5ebzMWRA6b8RohwOslGIfCb VBtpNW+oOj+SOdCxhzWpEQQkn5kKP+IR0m77VeBDndGh82Fp8MMh+5fHlZFasoxcBjmU 0KIOUz1UGYv0AHLNonvBDE+9gN73ViRUK9HaSX2U7Hm0wXZ9/rDVw5hbtS0BhxAJI4qi L/awY+ypaCHFZJKDm4BH9YcO9ZvtcJ3l48xxMYCC9EzP5isWrQrp5bVWWRzX6jo6R5qH 38RIMl5hnENRxiYb967Sw+XuSG5vVnvoUcBqzTPpimAO7f+u6Vliaj9aV0PrMVfE04vk RObQ== 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=pobv4dOE+1bYEdQetGDqa0iJ94RF7Txondtf0RwNnXk4KQJvYMYIIjT5MTGFvwOCB6 95OoxkqZoSc2aVFrWgTY3SgY5+MNkGbtHFzfpw6emAeKy6/B84NtsRbne0j3/DyGyl+O UdjWiKrauaIiZKZaaIrZgH5mmwc+I5qUbRoAqVjGe0/5JPfwNo/koGDsGr9hage0DD3L faqNXnnuBcUuwfjuc5cPVOS5I2GWcxOZ76FLulbI5/+ndvTPIMYQCvsJL/KTHMGZJ8/m 45FNzZ5nM7SkqDhLmYbZKKsWArnQDg5nfdha1nItBIJBww3vl+HYQCplbUXSF5XIcuWG hxCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0kmouiR; 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 ne21-20020a1709077b9500b006df76385e8fsi11249532ejc.815.2022.04.05.18.18.36; Tue, 05 Apr 2022 18:19: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=H0kmouiR; 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 S234778AbiDEH6u (ORCPT + 99 others); Tue, 5 Apr 2022 03:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233546AbiDEHr5 (ORCPT ); Tue, 5 Apr 2022 03:47:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23D1392840; Tue, 5 Apr 2022 00:45:20 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 266E7616C3; Tue, 5 Apr 2022 07:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35312C3410F; Tue, 5 Apr 2022 07:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649144719; bh=T2hstRTN2DoQMvevAT+LYxm/af106Jsj9SpEV7aDvFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0kmouiRhnk//DDFdOw7xrAuU3ZxqSBXAf9Laj1+0iqQmKF4pv+cWPwL5HMCSJxN2 OtS3EPB51yIUJpXicgTroDaYw+klnwovNJQ2kuGt9taFbvZBiFv24NbJW+t656CPfR mZQOlOBp33DLWV8PnJC20uOrf2nRA7RYssLUVh2Y= 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.17 0147/1126] video: fbdev: atari: Atari 2 bpp (STe) palette bugfix Date: Tue, 5 Apr 2022 09:14:54 +0200 Message-Id: <20220405070411.897574352@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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) |