Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp756085ybj; Tue, 5 May 2020 07:07:54 -0700 (PDT) X-Google-Smtp-Source: APiQypKqoJE4CL521WSacql4mtUgi07z8CpkG5P+6Poh+pM4tJht5kR5WQmVPv16gt7t+DtpeucA X-Received: by 2002:a17:906:a390:: with SMTP id k16mr2599895ejz.219.1588687674072; Tue, 05 May 2020 07:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588687674; cv=none; d=google.com; s=arc-20160816; b=0h8278vtAUKmKVwENJLpxy30uBPn1js/bEm8Bh4JnzW5vj5kiNLZDgIcKL8n38xtH7 FmCM8k1GOHS800CGWCkowN7ZxkzwBPzPBjJyB5AaBfS7tG6z9TPMtu+9OJwW+Jo7hJRX +QDjqh9cTv3DQfHDlt2KcM0SlowPiNcfFNoVogAimGthKPpxIt25sY6A06dcqtXxRBBf D84kX9Dr2CpWGBPf7MkTrKmzHT9X733eLoLca/S4ro+Ubgbe1dL1R/eoCbXcP5CBVVS8 CcYVSiLSwOAaUhpPL4yCbNvaU0e+RWNES18iZWdEyCRoGQ/Fo2Y7JA+hb+RLFlZyUjCq 5DZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=g+NicJ5jSZFdNPYoHrGOIiScOfaF+yQlKwKPQmfk9Oo=; b=iM7e1fsvmJrcxpjjMLmnRx3AMBE38N+D1hnG3fua5bgyVmqa7Rj+crn7jcnVnRFIBl MRvtulqyEZmN77z5qsKaDMT3dWs0cWvFAQWoN+ma9NSRHLFHSuPLCRZwK/d5sZ8tAqPP e1lDAEl4bBy1G/eIOOuIqc2Ifdzd7PPpyfnVSlnrO+FJN/vvGzBI5dAFQJs8ZvSy/c0x CWdKKa6/jc/9ZFYPpV0Uf6OHvJUXjAQHZorVzkBQiWGQaA6JL067iPf1dXS4E/8uijok qXqo1KIMiLhFWy9hzPggaQaHnd9YZkzoiv66xnLpwXq69ME0KGhGvL+96P9E8hig1zjK lD/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b26si1218451edw.447.2020.05.05.07.07.29; Tue, 05 May 2020 07:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729294AbgEEOCU (ORCPT + 99 others); Tue, 5 May 2020 10:02:20 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:42471 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728135AbgEEOCT (ORCPT ); Tue, 5 May 2020 10:02:19 -0400 Received: from localhost.localdomain ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1N49Qd-1j5KPS3F33-0107Nn; Tue, 05 May 2020 16:02:11 +0200 From: Arnd Bergmann To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Hawking Zhang , John Clements Cc: Arnd Bergmann , Tao Zhou , Guchun Chen , Dennis Li , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu: allocate large structures dynamically Date: Tue, 5 May 2020 16:01:52 +0200 Message-Id: <20200505140208.284473-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.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i0+w1T6PGTl4QgcW3lurPeHQIxVMfMiZzZwJb+KCUnQbNYpp0UdfuBib7a4L44eBtFC kn0PlqTfzUUwHMjku0boUq9b2pW5q8tkPyqqbXi3JkkTbTWn+c= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After the structure was padded to 1024 bytes, it is no longer suitable for being a local variable, as the function surpasses the warning limit for 32-bit architectures: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:587:5: error: stack frame size of 1072 bytes in function 'amdgpu_ras_feature_enable' [-Werror,-Wframe-larger-than=] int amdgpu_ras_feature_enable(struct amdgpu_device *adev, ^ Use kzalloc() instead to get it from the heap. Fixes: a0d254820f43 ("drm/amdgpu: update RAS TA to Host interface") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 31 +++++++++++++++++-------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 538895cfd862..7348619253c7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -588,19 +588,23 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, struct ras_common_if *head, bool enable) { struct amdgpu_ras *con = amdgpu_ras_get_context(adev); - union ta_ras_cmd_input info; + union ta_ras_cmd_input *info; int ret; if (!con) return -EINVAL; + info = kzalloc(sizeof(union ta_ras_cmd_input), GFP_KERNEL); + if (!info) + return -ENOMEM; + if (!enable) { - info.disable_features = (struct ta_ras_disable_features_input) { + info->disable_features = (struct ta_ras_disable_features_input) { .block_id = amdgpu_ras_block_to_ta(head->block), .error_type = amdgpu_ras_error_to_ta(head->type), }; } else { - info.enable_features = (struct ta_ras_enable_features_input) { + info->enable_features = (struct ta_ras_enable_features_input) { .block_id = amdgpu_ras_block_to_ta(head->block), .error_type = amdgpu_ras_error_to_ta(head->type), }; @@ -609,26 +613,33 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, /* Do not enable if it is not allowed. */ WARN_ON(enable && !amdgpu_ras_is_feature_allowed(adev, head)); /* Are we alerady in that state we are going to set? */ - if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head))) - return 0; + if (!(!!enable ^ !!amdgpu_ras_is_feature_enabled(adev, head))) { + ret = 0; + goto out; + } if (!amdgpu_ras_intr_triggered()) { - ret = psp_ras_enable_features(&adev->psp, &info, enable); + ret = psp_ras_enable_features(&adev->psp, info, enable); if (ret) { amdgpu_ras_parse_status_code(adev, enable ? "enable":"disable", ras_block_str(head->block), (enum ta_ras_status)ret); if (ret == TA_RAS_STATUS__RESET_NEEDED) - return -EAGAIN; - return -EINVAL; + ret = -EAGAIN; + else + ret = -EINVAL; + + goto out; } } /* setup the obj */ __amdgpu_ras_feature_enable(adev, head, enable); - - return 0; + ret = 0; +out: + kfree(info); + return ret; } /* Only used in device probe stage and called only once. */ -- 2.26.0