From patchwork Tue Dec 27 05:53:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Davenport X-Patchwork-Id: 36777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1240917wrt; Mon, 26 Dec 2022 21:54:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXsSeDCyOk/Rh9duDfpccFKeZFfItjLugv/I5EXpIF7usEZSTAgbDxmCX3X9pg2RTK45BCpP X-Received: by 2002:a17:903:32c3:b0:189:7819:e5c with SMTP id i3-20020a17090332c300b0018978190e5cmr31477620plr.6.1672120466912; Mon, 26 Dec 2022 21:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672120466; cv=none; d=google.com; s=arc-20160816; b=HD6IAJC4iH4waY9wJ7CzqVP9Wl1wk1EENnDnE1/5IJVZFmEd0+7JEY2FVObkTuDEpj u9HFPv1EhTmQqHn7+9/Xico+BCZ+C9ojtaSEIhmyTEVB5T0j7659jQh1QEPQf6CCvLZo KFYPYZGSNtzF+nFnpzVAxZChyzkDIFqg1eONmXxiQ3A22JUfZWkB+5hXu6iBqXfv6fhM zhOfKCA6RzG56y9ymuBYOJSF1nrGTgm+JV8SVsHUikk5abrcuSKo7fs3e4ta4uFBlHQN YXymj+6gQ/MBF+fW+kbayaB7c52kat9XTKOrNZi2kHztcwvwnx6mcj5Lcif7yxldakhj ZE3A== 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:dkim-signature; bh=9wARd1L8KoeksEpzilviu4ulCrJM4nCfjKCQtrReh+8=; b=DOUbL5diHG9jkZ9hrMOphWlpPlGOWqbtmCG8PSpI9jrjpHhVEv6dGG/t9FsYvKYcPi nrzV5hu3vKHBKg+iQtWL7wN4vU57NKPYz8Mq9R6ugAWUvwjCGWrUTzzwbKo8tj3HPnOm SWdWyJdlWs/AkCIYqBo5iq4DlaPz9JRrj4+M/qWxrrCAGTv6UnEC0WRpVNIiOOx1iSye DhX4xnwVCT/wgkpGJmqSIhTIkohRiW7l0M4jeH0BxCuGax/obyvB9A2alvxBh+5h+pbP oz9DzXPAjjEQCikzxeLG/YWaZSV/NkCBuw5Mf9FOc940s6fR8Sl5vVznpBcKOze06qeM RIHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KtWR1NWX; 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=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a170902d4d100b0018701f083b1si14650109plg.619.2022.12.26.21.54.10; Mon, 26 Dec 2022 21:54:26 -0800 (PST) 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=@chromium.org header.s=google header.b=KtWR1NWX; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbiL0Fxi (ORCPT + 99 others); Tue, 27 Dec 2022 00:53:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiL0Fxf (ORCPT ); Tue, 27 Dec 2022 00:53:35 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C20F21A3 for ; Mon, 26 Dec 2022 21:53:35 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id q190so6512362iod.10 for ; Mon, 26 Dec 2022 21:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9wARd1L8KoeksEpzilviu4ulCrJM4nCfjKCQtrReh+8=; b=KtWR1NWXObtv0A+S1nWRpm41eZaY26/OpoTg1WUZ0w96TGoaGxTskVlBy9RmAUg26I R50W5tkC5ZcQFkjLlDpE3K+Eebi3Ek2LtjejuCN1dyyzmdDotjvb03OKSHhHed9q3n1F scwRYzxgCR93T0aHENr/aJvGK684YPRaGbyzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9wARd1L8KoeksEpzilviu4ulCrJM4nCfjKCQtrReh+8=; b=2NKxtNS/vIqpmyVVParmHy0uUOfWMb/VDu2RxDgtnmkPNKOY6U4NzNAsf73Tp4uHNf qCHMSKdOMalg4ZQroAo5N+vYk8j/0kI7aeLFbyqZ9h5muQKMM4Y/C63aQzmBAUuytFX3 YL7CC+c4Fg5V84z0q0g5wn4uJpRCAf2sxlQpXekByyExqQBwlOCp/Iz/8vItxGKF+QVz jpMzCNdf0mNzXAAAoxIi9f4AJlFHEhCmCBBGr4sBFtwcsbLC9FXo3tAIlisBesgmIUqY xe9Yd/XtKdeBuDoCim+8MTbzfSTsYJJP8A6rOrT4RrySSh4i8Pzw8gpjbg7AWiN4M1A8 rauA== X-Gm-Message-State: AFqh2kpxy2Q0kORn3FSrjNby3YhlVNq+VRZKbl9nrDMpXngsub/3/+Ce gJadORIk0ThGpNdb0WW7xJ+1bA== X-Received: by 2002:a6b:da19:0:b0:6e4:e62c:38e3 with SMTP id x25-20020a6bda19000000b006e4e62c38e3mr15013786iob.5.1672120414631; Mon, 26 Dec 2022 21:53:34 -0800 (PST) Received: from midworld.bld.corp.google.com ([2620:15c:183:200:2d44:773f:eb35:d838]) by smtp.gmail.com with ESMTPSA id z11-20020a05660217cb00b006df2b3f17c3sm4678335iox.30.2022.12.26.21.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 21:53:34 -0800 (PST) From: Drew Davenport To: intel-gfx@lists.freedesktop.org Cc: Drew Davenport , Daniel Vetter , David Airlie , Imre Deak , Jani Nikula , Joonas Lahtinen , =?utf-8?q?Jos=C3=A9_Robe?= =?utf-8?q?rto_de_Souza?= , =?utf-8?q?Juha-Pekka_Heikk?= =?utf-8?q?il=C3=A4?= , Matt Roper , Rodrigo Vivi , Thomas Zimmermann , Tvrtko Ursulin , =?utf-8?b?VmlsbGUgU3lyasOk?= =?utf-8?b?bMOk?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/i915/display: Check source height is > 0 Date: Mon, 26 Dec 2022 22:53:24 -0700 Message-Id: <20221226225246.1.I15dff7bb5a0e485c862eae61a69096caf12ef29f@changeid> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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?1753345390442526856?= X-GMAIL-MSGID: =?utf-8?q?1753345390442526856?= The error message suggests that the height of the src rect must be at least 1. Reject source with height of 0. Signed-off-by: Drew Davenport --- I was investigating some divide-by-zero crash reports on ChromeOS which pointed to the intel_adjusted_rate function. Further prodding showed that I could reproduce this in a simple test program if I made src_h some value less than 1 but greater than 0. This seemed to be a sensible place to check that the source height is at least 1. I tried to repro this issue on an amd device I had on hand, and the configuration was rejected. Would it make sense to add a check that source dimensions are at least 1 somewhere in core, like in drm_atomic_plane_check? Or is that a valid use case on some devices, and thus any such check should be done on a per-driver basis? Thanks. drivers/gpu/drm/i915/display/skl_universal_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c index 4b79c2d2d6177..9b172a1e90deb 100644 --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c @@ -1627,7 +1627,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state) u32 offset; int ret; - if (w > max_width || w < min_width || h > max_height) { + if (w > max_width || w < min_width || h > max_height || h < 1) { drm_dbg_kms(&dev_priv->drm, "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n", w, h, min_width, max_width, max_height);