From patchwork Thu Nov 11 10:10:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12614575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 751ADC433F5 for ; Thu, 11 Nov 2021 10:11:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A76361215 for ; Thu, 11 Nov 2021 10:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2A76361215 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 784846EA2F; Thu, 11 Nov 2021 10:11:04 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 719166EA2F for ; Thu, 11 Nov 2021 10:11:03 +0000 (UTC) Date: Thu, 11 Nov 2021 10:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1636625460; bh=Mh1fsiFLUqwZMJhBZTSNLuLGEoeXZpGJfBVlho6qc98=; h=Date:To:From:Cc:Reply-To:Subject:From; b=zB3Tv+ra2sn7UZt2iF7rlL0VX011KnbcJs0uZOTW42S9b47E+9iXFz9UUk8XdcC6z CcO++e0g2JkFYUELw99pe4/nCwcnqifheMkz2374XKv5qaG6DcQ6cGZu8Z70L/ouVY 4z7jGCoXmP8iCho/Lc++idivEtXUkO9NgJ26SWyAwIjFFaOXiz+oGK2OgRYLzImJe9 lLgEWe2M/bSk7vn+8JjJmTvrPyl+tiflut2qo0vW9c914ec3Vya/Kt/drBq1F/qJQP t1vrPwEwYSAHTk3hCgRcWRoHXcmPocDDLMvg1shSV1kQrjXlpJ2TuutjhzBOKBHMe1 +OwBpIqzJ4qkw== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH] drm: pre-fill getfb2 modifier array with INVALID Message-ID: <20211111101049.269349-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Cc: Daniel Stone Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" User-space shouldn't look up the modifier array when the modifier flag is missing, but at the moment no docs make this clear (working on it). Right now the modifier array is pre-filled with zeroes, aka. LINEAR. Instead, pre-fill with INVALID to avoid footguns. This is a uAPI change, but OTOH any user-space which looks up the modifier array without checking the flag is broken already, so should be fine. Signed-off-by: Simon Ser Cc: Daniel Vetter Cc: Pekka Paalanen Cc: Daniel Stone Acked-by: Pekka Paalanen Acked-by: Daniel Stone --- drivers/gpu/drm/drm_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 07f5abc875e9..f7041c0a0407 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -601,7 +601,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev, r->handles[i] = 0; r->pitches[i] = 0; r->offsets[i] = 0; - r->modifier[i] = 0; + r->modifier[i] = DRM_FORMAT_MOD_INVALID; } for (i = 0; i < fb->format->num_planes; i++) {