Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3611095pxb; Tue, 19 Apr 2022 06:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs2NmboWiGnPLMtR7k8C1vA2CVPa4ovRfba/U1LW4tvj8wN++5NktmqlSoMDyS9T6BKH4b X-Received: by 2002:a17:907:216f:b0:6ce:d85f:35cf with SMTP id rl15-20020a170907216f00b006ced85f35cfmr13914530ejb.517.1650375246109; Tue, 19 Apr 2022 06:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650375246; cv=none; d=google.com; s=arc-20160816; b=UNr67UgiLb3vUpTXBMAND2vfN6x4V6LpmfzAERxdBIKKn559/dyBMc1UbtBR/56h7E 2jfXMcLdvfc492cOicgSTi+6Y1TO/Dlm7BRjCm6+jsMELqIesh/rU5hR5RjtwhDz1MTW LDMpFwskBEgksdTvJVHOAC/bkPHTDOpSjK4eXOAiMYLdbUTM9R4wCcVWBg9liXUoNzT6 wrD4aFDe6AnIBj76DmQWiojQz1HLkGF6VnQSIhBXjfYQBCTCjnm0Lt0MiT5xPqJkHZJ6 2Hvm12rF4n+9/Vn9sRWQCmmuC02RDHpNb+yqLeikKBSIdNSNFuliCHoGisyc2tMjaJqh rklg== 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=CCVm60EKtoQOyX/bz5GYLboatLbKaVDlLSeBc2+XWaE=; b=nNd2YXHEi5Xetn5Dui9ZeYYDiCuToHJRUIU+ivG2R9IqZmwMqcFrFcqKZm2NuYLBs4 xRKsyqkYRsGzmHXiCJGnzXNXrhcwvunhXTE2JSxeyVBewHDrWK1K6i9XCkrnLjQ4kkgA l+Gg/PpPu0Ucfdvl16W2RzIIqmgjXHFyoKG0KWwyBSItsV/k4tUxHio/s18k85knV5bQ M3PYZ9V2cUd703ack8demCpETk70Sa3F6K5KSavvvJ/ymbGxlCIyTcrrYEFDikZEoesQ uWcYUhkGrswWk0ZtAGNKgJdvRwHPyL0yAcyg6A23ds4n5V9quMq7LDPCGz+nR3mTXDtr Bnvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BqytGLrW; 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 f2-20020a170906560200b006e01f1d9677si8987601ejq.532.2022.04.19.06.33.41; Tue, 19 Apr 2022 06:34:06 -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=BqytGLrW; 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 S245213AbiDROB5 (ORCPT + 99 others); Mon, 18 Apr 2022 10:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243696AbiDRNly (ORCPT ); Mon, 18 Apr 2022 09:41:54 -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 440F130F58; Mon, 18 Apr 2022 05:59:30 -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 C2B576097A; Mon, 18 Apr 2022 12:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD0F4C385A8; Mon, 18 Apr 2022 12:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286769; bh=X+DTD49G5uqzfzVm7vlJteDH5J5cgeu8LZ3LAc5aAyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BqytGLrWiR/GECKA3c+HoFEIJFp3RbW9oQ010CyeF8u+mKvPgPf3GNxiqUFMt00hw NHxr7H9eOxa8fySUdFZmdea4pmCBDIbiy9sJJ8ZVSotpiykOXkYk3Q7MJQZN2/wzV+ 27wlsxtkTRlbX6eLpRdMRNys3KrcubIokQhrWHZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 239/284] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire() Date: Mon, 18 Apr 2022 14:13:40 +0200 Message-Id: <20220418121218.535097775@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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: Dan Carpenter [ Upstream commit 1647b54ed55d4d48c7199d439f8834626576cbe9 ] This post-op should be a pre-op so that we do not pass -1 as the bit number to test_bit(). The current code will loop downwards from 63 to -1. After changing to a pre-op, it loops from 63 to 0. Fixes: 71c37505e7ea ("drm/amdgpu/gfx: move more common KIQ code to amdgpu_gfx.c") Signed-off-by: Dan Carpenter Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index 4f6c68fc1dd9..f3bdd14e13a0 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -157,7 +157,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - while (queue_bit-- >= 0) { + while (--queue_bit >= 0) { if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap)) continue; -- 2.35.1