From patchwork Wed Jun 28 13:24:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 113878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8935575vqr; Wed, 28 Jun 2023 06:41:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uFq5I26DIFtL3MdbbyZcrHIGAXOdUJw5NCVBHX3k+WVdbcm23JfqWdyYxRCsVKPAviBwH X-Received: by 2002:a05:6a20:841c:b0:119:c5a2:b360 with SMTP id c28-20020a056a20841c00b00119c5a2b360mr45285979pzd.12.1687959717942; Wed, 28 Jun 2023 06:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687959717; cv=none; d=google.com; s=arc-20160816; b=E6H/n+gbYk1cAGE/zo7WZA1cqjEIxnXADF6poXYHiGHDmBv/or39WfdiRLf5qnuqtn D56+0JyAf3LRXyhj+vpYBQlnaW2Tg3EI/773MMqFZrRHG+VapFexNqFBNZ224YAMzInx BIQ9lx32mrsmbZICwsiTWfVo7/5bYCMBg6fnk6yJ/wyVVprod6V6SkfpnWcnLZbHifIh mSKZGAEWVUF3NTYFQbz0yetLpmJWP5pX8IiLoYLAmu+eNYTDiCZbk5K6IwIZL97weiOe E9f69tkNc8HzOP6QDQLG2lKIiCZI12Biy9hNvMsHOSnctKev3e1bepg0nv3QyvJyzZjI DqPA== 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=/LZ2ZZXp4VThdhXHWGHB26YvtPVSFuycEcoNCNIh86k=; fh=SeKIH61Ul6egH2MHeD0asf2btnzV9h8cLk0rz+QpCbw=; b=JYTgzipieIKDMLbl44WmXRrnXdyQnSjDMwa9HMGNxp53qXBoZfrHf1jse+zqjBWtxa P8WTEx+QRQriez3a2yLFAM9FBbqCqyY7QMpg1qJTUJPklzF4IlwU4l0RxRsFo342mfGJ AOtpxOK3x42ffp/XPM/Qq4/KAfyvlPx1FaayBIV+hXMDSNiFl0/bJTqg330Irz2hkH8n zYzk1R71FWNwJYq0xMPbr2xsExXX1/OzhLoo+L4g3PtsdwHm+R39gapuRRQACdF07zwu 8VJd0t3xEsoKAbq46V1s6mx4a3ucb5hnkDQM01kcvDhylow2nRYjaG1JSys7y1Wr+jAP 39yw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a630c53000000b00553c4551a08si9276075pgm.887.2023.06.28.06.41.45; Wed, 28 Jun 2023 06:41:57 -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 S231443AbjF1N2o (ORCPT + 99 others); Wed, 28 Jun 2023 09:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbjF1N1P (ORCPT ); Wed, 28 Jun 2023 09:27:15 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD361700 for ; Wed, 28 Jun 2023 06:26:46 -0700 (PDT) Received: from dslb-178-004-201-159.178.004.pools.vodafone-ip.de ([178.4.201.159] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1qEVBz-00031t-9V; Wed, 28 Jun 2023 15:26:43 +0200 From: Martin Kaiser To: Helge Deller Cc: Pengutronix Kernel Team , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH] fbdev: imxfb: warn about invalid left/right margin Date: Wed, 28 Jun 2023 15:24:37 +0200 Message-Id: <20230628132437.87085-1-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769954049651902668?= X-GMAIL-MSGID: =?utf-8?q?1769954049651902668?= Warn about invalid var->left_margin or var->right_margin. Their values are read from the device tree. We store var->left_margin-3 and var->right_margin-1 in register fields. These fields should be >= 0. Fixes: 7e8549bcee00 ("imxfb: Fix margin settings") Signed-off-by: Martin Kaiser --- drivers/video/fbdev/imxfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index adf36690c342..5fbcb78a9cae 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -613,10 +613,10 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf if (var->hsync_len < 1 || var->hsync_len > 64) printk(KERN_ERR "%s: invalid hsync_len %d\n", info->fix.id, var->hsync_len); - if (var->left_margin > 255) + if (var->left_margin < 3 || var->left_margin > 255) printk(KERN_ERR "%s: invalid left_margin %d\n", info->fix.id, var->left_margin); - if (var->right_margin > 255) + if (var->right_margin < 1 || var->right_margin > 255) printk(KERN_ERR "%s: invalid right_margin %d\n", info->fix.id, var->right_margin); if (var->yres < 1 || var->yres > ymax_mask)