Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1740523rwl; Wed, 12 Apr 2023 18:18:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZcuWiun5LgDhPHeK8p9kxtC61E+no6ztEAtoDAZ1DpSCng/xnaG6/Bb83rCuzFdK0heAkc X-Received: by 2002:a05:6a20:8b84:b0:d9:8d85:eb42 with SMTP id m4-20020a056a208b8400b000d98d85eb42mr392081pzh.26.1681348730033; Wed, 12 Apr 2023 18:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681348730; cv=none; d=google.com; s=arc-20160816; b=Iy8Op9dRlXdvo0ukni9rDtTPuIdLD7CY7HTMpESayz3KJIfmY3LnYBKQtzoYThB2c+ TJEWCLenRXnuOPfqbfRs0rJ+r9SKDb4lirc8fSrUZhCbCFuusmY7PwLPDFboM5Rq6YNT GjqUfimdBpEkOIDA0Nomx29PLUJ5sSApxRY2igLILVia77ykV9e3oqr1SjWNlaU26lhM egKYqwwoMgL2oL4B6/qMYpznN0kfEMLZm7R0hDZVfqjxHyhOuBd5fzxN3jUrmpFpRnZj gfT4lMClMWVyYuWiGndqI5k7w5eQwtW6ogNx9fMg/7Zrz+SC6veu2d/X0QsjmKy257J/ vaRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:message-id:content-transfer-encoding :mime-version:user-agent:in-reply-to:references:subject:cc:to:date :dkim-signature; bh=Cg69FIuXpSGKniPco5iU9/Kh38PXBZPqpuZzQ9sAUCc=; b=esoakMHYA6pYymUvBCLdUtziNb263bKU2KQbaiAeW2iXXKZFAmPCsXPPUmaQMqdDwz TKv4zmTMileB3HvetXNP3e2bnevSxDUjYu6IUL/bTlY3xPoj/RQa48uCHZkWUEwvLQRh twZdMJm169maAy+rfoCtXwL4zR/jbgmOcR6bs3TeOAni7OOWs1yvRPFtE7GyNL2vsxKC nXdpq1dQ+Jbjy7WASi36ZpkZeDD3ySvUVPxzWwGmZo+eGyHRHVpx2OqzR2r5Tb0Inmm8 QINrMdtae3IRaxzaEDCD34TBAxVmpgJ+4odHupx6blS+uvJTl96SuYjbLx49pdwlHwxW 3i6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@panix.com header.s=panix header.b=Op77uQix; 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=fail (p=NONE sp=NONE dis=NONE) header.from=panix.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b004fbba9a8f99si501635pgb.856.2023.04.12.18.18.38; Wed, 12 Apr 2023 18:18:50 -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=fail header.i=@panix.com header.s=panix header.b=Op77uQix; 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=fail (p=NONE sp=NONE dis=NONE) header.from=panix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbjDMBNI (ORCPT + 99 others); Wed, 12 Apr 2023 21:13:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjDMBNH (ORCPT ); Wed, 12 Apr 2023 21:13:07 -0400 Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03BE2D73 for ; Wed, 12 Apr 2023 18:13:06 -0700 (PDT) Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mailbackend.panix.com (Postfix) with ESMTP id 4PxhQn3rp8z2v3l; Wed, 12 Apr 2023 21:13:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=panix.com; s=panix; t=1681348385; bh=3PDeKttSJ7pA4nWTc74l+a2Ub5ZqA+OBy7VNvMYiIY8=; h=Date:To:Cc:Subject:References:In-Reply-To:From; b=Op77uQix3100OFjDvoMlpPYbSteO8ND9VvXA1Pg7DNdYTxisW9eMVQyg2wqrzTbcL i8ZzO6YTDMouMD0Dx3+Bn/ShG3ASZaDgZOpVLsuMkkcSK+KkRxbinLyC0/RSWV3O3u iYaTL5FVZa/jUXsQuv4SqwAbPhUjyZUbc6Deqp4o= Received: by panix1.panix.com (Postfix, from userid 19171) id 4PxhQn3zK1zcbc; Wed, 12 Apr 2023 21:13:05 -0400 (EDT) Date: Thu, 13 Apr 2023 01:13:05 +0000 To: pa@panix.com, javierm@redhat.com Cc: tzimmermann@suse.de, pa@panix.com, linux-kernel@vger.kernel.org, jfalempe@redhat.com, hdegoede@redhat.com, dri-devel@lists.freedesktop.org, daniel.vetter@ffwll.ch, ardb@kernel.org Subject: Re: [PATCH] firmware/sysfb: Fix wrong stride when bits-per-pixel is calculated References: <20230412150225.3757223-1-javierm@redhat.com> <2e07f818ccdff7023a060e732d7c4ef6.squirrel@mail.panix.com> <87jzyhror0.fsf@minerva.mail-host-address-is-not-set> <1afd3044c2aca9322ecf304941c7df66.squirrel@mail.panix.com> <87fs94stgw.fsf@minerva.mail-host-address-is-not-set> <87cz48srs4.fsf@minerva.mail-host-address-is-not-set> <40edb0fdb0eaff434f4872dd677923a6.squirrel@mail.panix.com> <87a5zcsqg8.fsf@minerva.mail-host-address-is-not-set> <9e6fff69b09b36cbdd96499cd0015154.squirrel@mail.panix.com> In-Reply-To: <9e6fff69b09b36cbdd96499cd0015154.squirrel@mail.panix.com> User-Agent: nail 11.25 7/29/05 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <4PxhQn3zK1zcbc@panix1.panix.com> From: pa@panix.com (Pierre Asselin) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 After careful reading of the comments in f35cd3fa7729, would this be an appropriate fix ? Does it still address all the issues raised by Thomas ? (not tested) diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c index 82c64cb9f531..9f5299d54732 100644 --- a/drivers/firmware/sysfb_simplefb.c +++ b/drivers/firmware/sysfb_simplefb.c @@ -56,10 +56,11 @@ __init bool sysfb_parse_mode(const struct screen_info *si, * don't specify alpha channels. */ if (si->lfb_depth > 8) { - bits_per_pixel = max(max3(si->red_size + si->red_pos, + bits_per_pixel = max3(max3(si->red_size + si->red_pos, si->green_size + si->green_pos, si->blue_size + si->blue_pos), - si->rsvd_size + si->rsvd_pos); + si->rsvd_size + si->rsvd_pos, + si->lfb_depth); } else { bits_per_pixel = si->lfb_depth; }