Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4504424rwd; Tue, 23 May 2023 08:32:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ALih35+wWXpFA9su/5caqcs0Ubs5eUcmFYs6UREXWOyNIJnCAF5c4XA27NlVWUKALjz/g X-Received: by 2002:a17:902:7249:b0:1ae:1a33:6c with SMTP id c9-20020a170902724900b001ae1a33006cmr13885884pll.31.1684855931730; Tue, 23 May 2023 08:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684855931; cv=none; d=google.com; s=arc-20160816; b=nkU7pfDQYztwBGWs+jFt+z7xuMFtZR/47YWJiwW0rCvLUpNs7otFK09bGsJBDokCpR 3mTrUgbHvAeyHEj2b4s9ETtRO0m8Hs3b27YxWcZVm1/n5oGTfFcKG2fgFiN2INS7fDg3 RLLQUe3QjZpcZ6UREBwJmObFamkqKdHpwq3pxRLjTcqSti3d1sjmzTo8ZrtdX5PspQlw FG4l8FXg/tBZapCOjkHiCgmDlM3CynCqHRetcbwD8BWT7BqCKXZZ1NQbPg0bJg0Obdmr 8UCQiGGt4ICL4yxZ3X22wFFNplpl2ywqa5sPmkN0UXAF9SkKT3hISe2fhz9NoRY6XJBP f2zg== 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 :message-id:date:subject:cc:to:from; bh=PB0/S4sqnqT4Ml80LqHsWdiTrTVuNxKA4YlDjRc8bmQ=; b=x8EWS6CIcMaufZ7tgPNXQTbhl3Xbkx6jQFh2OEiSHC12nCqMN5vd8ixX8qZxbSjiXu kmOwjU84QcuwCt5E5yKZ6c0SdjcaqZUWFfHfGuwHg4BCSXNiouLAzU+EAxH9T2ukWMi7 wnh+5F2U2Y6G1pRVrWHYgQQhZy3A7x+N+nyzEBBCfmphpVzAqr8P0Cqy83iR/vNrZDBy 2Fr4aLa+ct7gh5NU7kcCNOaDqsvZsHPCC3bMftMTY2fDrD9wewlwP8SkYmI4zpIe1KAl uWlV5qFqTRw9C7QAhML/EbTE1Bl25TmcM+U0Ox/WagjGVlmLgk1HHsKbHx28GtDcyCAV sB0w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a170902f7d600b001ab18790b0fsi6583572plw.95.2023.05.23.08.31.54; Tue, 23 May 2023 08:32:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237135AbjEWPIQ (ORCPT + 99 others); Tue, 23 May 2023 11:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233974AbjEWPIP (ORCPT ); Tue, 23 May 2023 11:08:15 -0400 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D2D8FA for ; Tue, 23 May 2023 08:08:14 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:b0ac:7afd:272:4cff]) by laurent.telenet-ops.be with bizsmtp id 0F8C2A0040Jkz7G01F8CtD; Tue, 23 May 2023 17:08:12 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1q1TcD-002sva-Fm; Tue, 23 May 2023 17:08:12 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1q1TcR-00CkJ4-UB; Tue, 23 May 2023 17:08:11 +0200 From: Geert Uytterhoeven To: Russell King , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Russell King Subject: [PATCH v2 resend] drm/armada: Fix off-by-one error in armada_overlay_get_property() Date: Tue, 23 May 2023 17:08:10 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE, 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 As ffs() returns one more than the index of the first bit set (zero means no bits set), the color key mode value is shifted one position too much. Fix this by using FIELD_GET() instead. Fixes: c96103b6c49ff9a8 ("drm/armada: move colorkey properties into overlay plane state") Signed-off-by: Geert Uytterhoeven Reviewed-by: Russell King (Oracle) --- Compile-tested only. v2: - Add Reviewed-by. --- drivers/gpu/drm/armada/armada_overlay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index f21eb8fb76d87285..3b9bd8ecda137f6d 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -4,6 +4,8 @@ * Rewritten from the dovefb driver, and Armada510 manuals. */ +#include + #include #include #include @@ -445,8 +447,8 @@ static int armada_overlay_get_property(struct drm_plane *plane, drm_to_overlay_state(state)->colorkey_ug, drm_to_overlay_state(state)->colorkey_vb, 0); } else if (property == priv->colorkey_mode_prop) { - *val = (drm_to_overlay_state(state)->colorkey_mode & - CFG_CKMODE_MASK) >> ffs(CFG_CKMODE_MASK); + *val = FIELD_GET(CFG_CKMODE_MASK, + drm_to_overlay_state(state)->colorkey_mode); } else if (property == priv->brightness_prop) { *val = drm_to_overlay_state(state)->brightness + 256; } else if (property == priv->contrast_prop) { -- 2.34.1