Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2911578rwb; Mon, 15 Aug 2022 13:54:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/EFhsR17bTfTwZODgHZU/2gxogUwS0jTRQ/eQmsUpRYkqkRYyNA6tdCMBG9vOdG/S5ljn X-Received: by 2002:a17:902:e5c9:b0:16e:f3b6:ddc4 with SMTP id u9-20020a170902e5c900b0016ef3b6ddc4mr18568551plf.30.1660596870441; Mon, 15 Aug 2022 13:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660596870; cv=none; d=google.com; s=arc-20160816; b=NEbzVbd4BcJvzdnjmwRB8zvChJL16rFMq5vwzNrqV+QQzPU99RQB1ap/0G3s8wGbah eNPwpsQtDztWQkPi1UNFxVRNOxLhsT/ccgfJFEqCbmMsBvBfN6c5P27qwfcnjRLB9YMa TXq/9xxjwd400m5Y4RzMrUz8rhJvrP5F6gWAaQHIgi58wtFneE+kPbA5o7g8F3nrZbES LlkOsAe/CMK7TDjHG6DL1qq+269tfSneHEQLvXTSAflQIl7jfYx2ChhQlmyoI2J1oLRf f1rGsv2b/tV4KoHXA9EQPK5lAIykVRmYG6c76Kb8m30mGRnJxfJIbHPfpe9YGWsYasul WtjQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PTAx7le4P0wR8lWWAi4RluiOkjkdmFdEA2LRsQ2vPCk=; b=i6iIN7jXdon+F+g2Cs+AxHhdn6mZQJY438YOWPo80BVYYb3HM10lubxRRIk/qOZE9J rS1Pl4H3+Gn3mud5IyeSGOuo3yb2EY5Y9Gd7F15krN7RxN83vXZ0hByUrnmoSxHQfbTc cvVInoOc0FTsci6frQP8ByD5xFbDNWcDfpsKci6Oeiv0YfStcjfgA3LED0gULfmuhQJa 2PhDlBUR+66xUn0qoEnOCx0qisOKnSiHfKhyNHEH+ePJClFNXQNbwvH3bdDIrG/TwzR7 m1bf2VsHpn/FWJJ/3rh8VTtjD1dH4qL+INzrQhPHoTKUvqUGlk878GZoX891hN56ZGDU sbJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Up3TCvAg; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j70-20020a638049000000b003fdcf4695c8si5649796pgd.400.2022.08.15.13.54.16; Mon, 15 Aug 2022 13:54:30 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=Up3TCvAg; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244088AbiHOSth (ORCPT + 99 others); Mon, 15 Aug 2022 14:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243380AbiHOSoA (ORCPT ); Mon, 15 Aug 2022 14:44:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3BDF2F67D; Mon, 15 Aug 2022 11:27:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6343460691; Mon, 15 Aug 2022 18:27:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51C03C433D7; Mon, 15 Aug 2022 18:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588034; bh=zYrR9oYzIaayks9bURRjZG2gtT1h3u/amPt6DIA3Tbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Up3TCvAg00RnUBp1wt8OIqYsKpa9reYRLQ+oWxrpJnyGfiTaNco6sKsYa3+8X/APs rjD50MXBELr09KwUFGzIGOuvFDDxrUqFKizImvRc3cFKrgjpwt2quUMOYD1FirE9nz peJwplh6QDl042FLh8hfyZ0eBU/ZS9FEfLQC0yf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.15 257/779] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init Date: Mon, 15 Aug 2022 19:58:21 +0200 Message-Id: <20220815180348.333416901@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Miaoqian Lin [ Upstream commit c24968734abfed81c8f93dc5f44a7b7a9aecadfa ] Since drm_prime_pages_to_sg() function return error pointers. The drm_gem_shmem_get_sg_table() function returns error pointers too. Using IS_ERR() to check the return value to fix this. Fixes: 2f2aa13724d5 ("drm/virtio: move virtio_gpu_mem_entry initialization to new function") Signed-off-by: Miaoqian Lin Link: http://patchwork.freedesktop.org/patch/msgid/20220602104223.54527-1-linmq006@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 187e10da2f17..9af9f355e0a7 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -167,9 +167,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, * since virtio_gpu doesn't support dma-buf import from other devices. */ shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); - if (!shmem->pages) { + if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); - return -EINVAL; + return PTR_ERR(shmem->pages); } if (use_dma_api) { -- 2.35.1