From patchwork Fri Mar 25 15:43:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12793571 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 97772C433FE for ; Mon, 28 Mar 2022 13:09:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE13410E65B; Mon, 28 Mar 2022 13:09:20 +0000 (UTC) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE62910E76D; Fri, 25 Mar 2022 15:43:27 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id h1so9743042edj.1; Fri, 25 Mar 2022 08:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UP4oquXI/E3mtdW950mzpwsU3zSTx1OYvcht8inS1yQ=; b=lZZDUTz79zDw3QYJiXP15xKVaJZLoUdcKasNVnNzVkhiYpSRANlH6yrHPIk0D0fF57 6armA0Dn1otC3IA3Jz1L8T9mXPwoBI+A5NwUfGvg6CNe/+y51it2bxHbUpYoYrgnpbbA 4p/JAfYBRo8+eq+wefQa7M1wgoPp1OepEj4RcxuoIwFBtVFYDUk0oH/dEpmTdq+MBDYV 2z305zdugDZFq+8FnIZ0HlAB7etMX72TvJVFj1NQ78r+xuG54pLlSJccxtQ37ykX8isY S53fl9wIBozfXdx13wJqUfjl8Xt3FIbDgpe7D1YPvf5KiiuXdawN0kpQ37xLn+BooCk3 HhiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UP4oquXI/E3mtdW950mzpwsU3zSTx1OYvcht8inS1yQ=; b=zdgZi4FSMsLDE4Lp7KIJrdM1d9IN2zQMIeeOUvZZEZgLBIuWKQH/Ts5eo3RD+dF0Ai dCTY6HfoU+sHgHP42lgVtzVxsQQolDIDPAQK1OW0ZiO27EzYvtIOL33CPY8AgBnRbSXM Km+WOb52+R57ZVQ3Ma7GIvFCXzXuyFxbOYM4hfC3droiSpOXP3FCeKvCV6TZT5i01cuI TuljEK6pwTWaks4NFjqvonSrgLo7mpqCkF1967qIf0nDHS6CHr+ipp+DeSLQynJQhP3S rjAYREn+wBXjn5TkMfO1P8vW7xSYmMIJVFWbWgJLcoVp1J56tXJPsB7G4sWGoXrH3ctL GyGA== X-Gm-Message-State: AOAM530rDv1Nhx7Z3OZYFskuX/wKbwWtZkH0nq7DR4HItFMXzuj88Sa6 sZI48pCdblHT+5ySP9C0UwU4tlydAi4= X-Google-Smtp-Source: ABdhPJzycRLB4TnsWMwakRM/fgWS7O99ZGSgmT5FuDWQeIKDN8+qshW2+aLHqHXTeUlq69ucfM4bjA== X-Received: by 2002:a05:6402:4247:b0:419:3c6e:b0bf with SMTP id g7-20020a056402424700b004193c6eb0bfmr13539604edb.374.1648223006327; Fri, 25 Mar 2022 08:43:26 -0700 (PDT) Received: from EliteBook.fritz.box ([2a02:908:1252:fb60:17b5:736b:9621:3369]) by smtp.gmail.com with ESMTPSA id hs12-20020a1709073e8c00b006dfd8074d27sm2439558ejc.79.2022.03.25.08.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 08:43:25 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Date: Fri, 25 Mar 2022 16:43:23 +0100 Message-Id: <20220325154323.221765-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 28 Mar 2022 13:09:20 +0000 Subject: [Intel-gfx] [PATCH] dma-buf: WIP dma_fence_array_first fix X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Looks like somebody is creating an empty dma_fence_array. Signed-off-by: Christian König --- drivers/dma-buf/dma-fence-array.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c index 52b85d292383..5c8a7084577b 100644 --- a/drivers/dma-buf/dma-fence-array.c +++ b/drivers/dma-buf/dma-fence-array.c @@ -159,6 +159,8 @@ struct dma_fence_array *dma_fence_array_create(int num_fences, struct dma_fence_array *array; size_t size = sizeof(*array); + WARN_ON(!num_fences || !fences); + /* Allocate the callback structures behind the array. */ size += num_fences * sizeof(struct dma_fence_array_cb); array = kzalloc(size, GFP_KERNEL); @@ -231,6 +233,9 @@ struct dma_fence *dma_fence_array_first(struct dma_fence *head) if (!array) return head; + if (!array->num_fences) + return NULL; + return array->fences[0]; } EXPORT_SYMBOL(dma_fence_array_first);