Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp23254pxb; Tue, 12 Apr 2022 15:42:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhzZOGDHj76HTeaEBC5fpXJYWizsRX+oetKu4yHWeunM/bp2QThD8oXpaw4G4abxyRFYfq X-Received: by 2002:a17:90b:4b11:b0:1cb:2a65:f275 with SMTP id lx17-20020a17090b4b1100b001cb2a65f275mr7479861pjb.33.1649803375489; Tue, 12 Apr 2022 15:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649803375; cv=none; d=google.com; s=arc-20160816; b=bOyXP/k7PWxVZmanRFEgZRwRXHOlXumQ27ovQ4moqC61Uxb7lYUVo+x2aVFk7nTIxM lND2YBpEY3NI6feS9mfeYPZslXOpukiy31KlEzG5OUG0kbQs2sjMif0/PZ98bZxpwvS/ HNOqEikSBKja5mtq3xi0yfzSaFMo3u8YEAF9QRcihs8mlUy6PZWxNmaJMlJV+fd/gTfs YoLdu0Yq5aMk2bXETXXKB2ewe1gPzjx/jSeLinAoOE4da0gc8hogFigvaGze/EHlwFdI kawWGXtbIiloCHh7QYWB5Z/BW5XcVoGoosPg8A6ZFJK4Gf2Qq8/pzR+8sMTAf3lJuhDb S2qA== 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=huWNRdssLisraxC8BGugdQ9BGm6l+OBzWFLVfmOtUZI=; b=II9AbQd+7LHdrMn0+TMmH+j8NGGF+rjGTpgqNjSvw6JP7ql35c8JiL+LRmIybd9oWv R1q50Vv3de8jeaznl8vAFytRWnl7LUyPBZ2rnCtWS4KVeksfwbKK2FilFU+2ztCoDl9y oBr9Lj5PL8W8Bqcx7Fl8p4uZ6n3XFCar+D9tEUjrk31l8J4nxnW4m9KnROmdXioDmq+g wHVvAb6YCvlYn2vjJRdZrjY5fUHS0tl2qiRnSohCds3I42w10NRYe64mNBpRBEYnnNug U39H+aZlvvsgWwWBidSaUcMJFc6Q++DejTrIcXQrF4EpX1lK8Ay0hrk/GS7erY2dLPmS h+Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zJSN30Qr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y20-20020a056a00181400b004fa3a8dff4esi13667216pfa.5.2022.04.12.15.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:42:55 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zJSN30Qr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DDB641AF52C; Tue, 12 Apr 2022 14:24:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376261AbiDLItO (ORCPT + 99 others); Tue, 12 Apr 2022 04:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357613AbiDLHkc (ORCPT ); Tue, 12 Apr 2022 03:40:32 -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 CDF6C31DC2; Tue, 12 Apr 2022 00:16:13 -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 299C46176E; Tue, 12 Apr 2022 07:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A65EC385A1; Tue, 12 Apr 2022 07:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649747772; bh=vSEirDE08DDshdO7veGpX3SMni+/P5RvHskaZiqXZ6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zJSN30QrFuICAXt+O/AsjFzOvoEhCt/iLyxtsziA+f7juTArQnfAisXza1wBjhJs0 NOCOVf1nhAciz9m1j0hZx0BgSzKXPFuv6tJqKIdBTkTZHVP/7y2dLeU7fIaKtsPtk3 pTZhdp7nE72YB2dATKK1JJatV0qWaeIfk11c5J4I= 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 5.17 193/343] drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire() Date: Tue, 12 Apr 2022 08:30:11 +0200 Message-Id: <20220412062956.928663949@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062951.095765152@linuxfoundation.org> References: <20220412062951.095765152@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 1916ec84dd71..e7845df6cad2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -266,7 +266,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