From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944AB238140; Wed, 17 Sep 2025 12:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758112811; cv=none; b=MWpdYDHu1ErTXm45bBtaOQpczjZvWYLHNzxl9j/pwh3D/0cQ+ZJ9z8QZ3XoaB2jI1AKsWZFnnLkI0J2hAlTKR9A0Rdyg0kI51MJAkDJiqtzPRgkVBQ/PuIq2O4y1kcQT7b8KK62g08lmOtJH/zffkmVkLW+gVMzWTZ4l1rlIIGA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758112811; c=relaxed/simple; bh=KQWCn+9ESROkD7mxymEUPEJuB9ViV+MmpHkPqggY7n8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hhttl9Z31/osslFK0hNTHpWobn9dC1gnInue8Xxfyn8jD0OkBDdNZaX/6W5OcX1r4AjW5G6Wdjj/XqnbeYP+uo3xkWPLG1KAoMT2b08QggWLxW1t+fQ0rrauv/t6iGUSrU3vlelwTqIJSaw6loYHst3dNjTfj4hkW4G9Uchi7AI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iqUp9BW4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iqUp9BW4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13437C4CEF0; Wed, 17 Sep 2025 12:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758112811; bh=KQWCn+9ESROkD7mxymEUPEJuB9ViV+MmpHkPqggY7n8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqUp9BW4/v5vhsxsQqUwQk5mjEtCgOaRdaqQ2mktCEJ+PpxERbv013scuPK70Seeq 9ov5CfDm/1pA9CcZOgNPxJRTDNgiNGsATwaREPcLCLoyQ0C8pO8NA+dxkiYAcXcfAL 6+fZN5UDnPJz8KnViMgBctZhxxJ8lcDwid+b8qSo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Matt Roper , Jani Nikula , Tvrtko Ursulin Subject: [PATCH 6.16 084/189] drm/i915/power: fix size for for_each_set_bit() in abox iteration Date: Wed, 17 Sep 2025 14:33:14 +0200 Message-ID: <20250917123353.912441940@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250917123351.839989757@linuxfoundation.org> References: <20250917123351.839989757@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jani Nikula commit cfa7b7659757f8d0fc4914429efa90d0d2577dd7 upstream. for_each_set_bit() expects size to be in bits, not bytes. The abox mask iteration uses bytes, but it works by coincidence, because the local variable holding the mask is unsigned long, and the mask only ever has bit 2 as the highest bit. Using a smaller type could lead to subtle and very hard to track bugs. Fixes: 62afef2811e4 ("drm/i915/rkl: RKL uses ABOX0 for pixel transfers") Cc: Ville Syrjälä Cc: Matt Roper Cc: stable@vger.kernel.org # v5.9+ Reviewed-by: Matt Roper Link: https://lore.kernel.org/r/20250905104149.1144751-1-jani.nikula@intel.com Signed-off-by: Jani Nikula (cherry picked from commit 7ea3baa6efe4bb93d11e1c0e6528b1468d7debf6) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_display_power.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_display_power.c +++ b/drivers/gpu/drm/i915/display/intel_display_power.c @@ -1169,7 +1169,7 @@ static void icl_mbus_init(struct intel_d if (DISPLAY_VER(display) == 12) abox_regs |= BIT(0); - for_each_set_bit(i, &abox_regs, sizeof(abox_regs)) + for_each_set_bit(i, &abox_regs, BITS_PER_TYPE(abox_regs)) intel_de_rmw(display, MBUS_ABOX_CTL(i), mask, val); } @@ -1630,11 +1630,11 @@ static void tgl_bw_buddy_init(struct int if (table[config].page_mask == 0) { drm_dbg_kms(display->drm, "Unknown memory configuration; disabling address buddy logic.\n"); - for_each_set_bit(i, &abox_mask, sizeof(abox_mask)) + for_each_set_bit(i, &abox_mask, BITS_PER_TYPE(abox_mask)) intel_de_write(display, BW_BUDDY_CTL(i), BW_BUDDY_DISABLE); } else { - for_each_set_bit(i, &abox_mask, sizeof(abox_mask)) { + for_each_set_bit(i, &abox_mask, BITS_PER_TYPE(abox_mask)) { intel_de_write(display, BW_BUDDY_PAGE_MASK(i), table[config].page_mask);