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 420C7C433F5 for ; Fri, 28 Jan 2022 19:30:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C005D10E4B9; Fri, 28 Jan 2022 19:30:17 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEDF510E4B9 for ; Fri, 28 Jan 2022 19:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643398215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=SEZKuudk9FTI+7yAy64FaqZEcUXfR8+t/aDwSXBZQrU=; b=aacHlGn56TCRRH3MTppeUQ2oQFLWRvDrRFS7y7mTpJtVrnDAQvB/cEojfueYsan1P3dtTW 2C/f6X1PvOz4EdV4vkN79YNXQ03P8tmwjqiZDaKoNUkguROLQAfxUXZvO8B7lC1GjV6C4t hf29Td3otHNqexqPnJRsPqdnV/LIjc4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-yybfL9f6PuOsydIGP4KB2A-1; Fri, 28 Jan 2022 14:30:13 -0500 X-MC-Unique: yybfL9f6PuOsydIGP4KB2A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A665100C662; Fri, 28 Jan 2022 19:30:11 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.11.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 888275D6B1; Fri, 28 Jan 2022 19:30:00 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org Date: Fri, 28 Jan 2022 14:29:50 -0500 Message-Id: <20220128192951.626532-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Subject: [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()" X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Greg KH , open list , dri-devel@lists.freedesktop.org, Ben Skeggs , Daniel Vetter , Zhou Qingyang Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" This reverts commit 2343bcdb4747d4f418a4daf2e898b94f86c24a59. Unfortunately, as Greg pointed out I totally missed the fact that this patch came from a umn.edu patch. umn.edu is still banned from contributing to the Linux kernel, so let's revert this for the time being. I'll re-evaluate this fix myself later and send another fix if this ends up being valid. Signed-off-by: Lyude Paul Cc: Greg KH Cc: Ben Skeggs Cc: Karol Herbst --- drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c index a6ea89a5d51a..667fa016496e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c @@ -142,12 +142,11 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver, hsfw->imem_size = desc->code_size; hsfw->imem_tag = desc->start_tag; - hsfw->imem = kmemdup(data + desc->code_off, desc->code_size, GFP_KERNEL); + hsfw->imem = kmalloc(desc->code_size, GFP_KERNEL); + memcpy(hsfw->imem, data + desc->code_off, desc->code_size); + nvkm_firmware_put(fw); - if (!hsfw->imem) - return -ENOMEM; - else - return 0; + return 0; } int -- 2.34.1