Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp33948pxb; Fri, 15 Jan 2021 05:13:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHsgDYpzwzQOrrnUXhInHhcaIg2EqA+oX/Nt+9UdDyQ0etDRctZnijFrGBIv3n0C7ZtC1x X-Received: by 2002:aa7:c603:: with SMTP id h3mr9671137edq.254.1610716392869; Fri, 15 Jan 2021 05:13:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610716392; cv=none; d=google.com; s=arc-20160816; b=COXck9SR6H9+HFgXWXfS3qNX8VEYquCZRxY062PQFYHKHdCfFH/zaTcSYtIAbthwbm FA8e3PZBBbi32kRw4hYpU5wCIojBU+wCy/X6Hzu8EZ9dcnKGNg6i+d3eHEEWgbJPgKYb o7OrjqifLvDZrYZErVG93SmZyZPVy5Nh+6GnEgAc/AztOr727uG+VL/EaDD7nS6ZXhtk JW/KJzck4u38Y9qWNg9QIQaLzYsF8lybvCLFmnpYoR76lccBka+txFBmAtDMWPOQJ1k2 h+dlS0fqwu0Dt5KkzqKGbItzfEXZHBizxy4ehBW0KBOEJa4BtlQufa4NdTqna2Vdivo8 mbZA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nj25LfTkFrAAE+qx8en0KB7gSAPCw/LDljzLCu37kJw=; b=mWA690EQznbFGT9HnfNbmKxTTkR7SzJo82BfdBNywBUWIxRyLVJI3PPKdReDZtkEW9 XKlLUxMlABiqPLwdR7mosAfxLm4LfYJqtDyKKBROpwVrPeMDL5Z4s0WUvLlzT0WkSz0K vTTpaMXNLH2q/XTW64j6bewwbUBasuZ3wQHDI7ukjH9Zf0vB2zKnhs2GDrzwnycksrxS QWzBmlAgWCPBcVyKCr0rhtIN9/5OxBZfQJnZOpzigvBYLHkHs0OeGqMbWMhpYnMgmaEY Ee/zUGgsJGpHe3zYB2GpQgc0/JTMh+P0IVRYxqXc0TimqnmmOas1uiK9dt8c8bbN4XFr Lt0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RbBIDKsG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h18si3724018ejg.486.2021.01.15.05.12.47; Fri, 15 Jan 2021 05:13:12 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=RbBIDKsG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733164AbhAONKL (ORCPT + 99 others); Fri, 15 Jan 2021 08:10:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732595AbhAONKJ (ORCPT ); Fri, 15 Jan 2021 08:10:09 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5419EC061798 for ; Fri, 15 Jan 2021 05:09:28 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id y22so10270885ljn.9 for ; Fri, 15 Jan 2021 05:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nj25LfTkFrAAE+qx8en0KB7gSAPCw/LDljzLCu37kJw=; b=RbBIDKsG5AyXSoGKHLolqmP9CsgzbCWO7vIeUc586k5RKCpmBkSNZvo+UIZ+HX7Xmh 9814SPTXCc7VQ4hvKBI9H+F46fmpyTOy9r1/A1Ja9DHKRRU7jqj8gG3RARLIGSeSCI6S AKH/pa1h635Me4UmzBSKO1y4Zvq53UnfOjlqalouLYWy4mhD+vmZ3K+3hdoauVpKMCJJ ROWvhachqr9PexOH3QFs8xyi4zQTufu5RPiMPkOn5CbzmIqiKLwhElSPAl7YKxleeBMM iAhg510vTb4oZ6Uys/oYjHA5Oc0CFDjm7Qg0Mb5BI3TyQ+wCCiu6jo8222X6AVwAOaOW KL+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nj25LfTkFrAAE+qx8en0KB7gSAPCw/LDljzLCu37kJw=; b=p0jwrKIhqiRVLh2sJoYyjbuFfSu61nIrhyec7Qw0CjoDrEwKHrb5AJ5i044F3pRW4B DdPnzETyUlZb/+AOWMHheEy0g+CS148YgcNZUy3LXC5rG9qRdYxsX+FdC41DyLFOFmLK awi1ifFg7wDVQKTmhkDsHKd9y+rv6bmQcO3xulioBlZQR+XrwEE+JfUJ8ZG0bRd6t5mJ Fpyi/fHbiaN21ydGP2cNS+6bDXPqWYARGMssGr3w+rHOpVyxhZ3r6eTddoD3LTPOgrMN j/Crpgj4KNtw3xcmqZ7REflyw/AqhHZP7oaXzgd7ERXo81q9gceotM5+ED5e0GlWtAgu JhfA== X-Gm-Message-State: AOAM5331cDUIvMFtAKIYlcuz9vqy19BigoGza/6VfX6MTk2DYLzNd6Cd RhMICuxF2gVfkCBJSxWHJEp9Bg== X-Received: by 2002:a2e:87d2:: with SMTP id v18mr5339872ljj.464.1610716166861; Fri, 15 Jan 2021 05:09:26 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id i11sm894372lfl.297.2021.01.15.05.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 05:09:26 -0800 (PST) From: Anders Roxell To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Anders Roxell , Nathan Chancellor , Naresh Kamboju , Nick Desaulniers , Thomas Bogendoerfer Subject: [PATCH] mips: lib: uncached: fix non-standard usage of variable 'sp' Date: Fri, 15 Jan 2021 14:09:06 +0100 Message-Id: <20210115130906.1084281-2-anders.roxell@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115130906.1084281-1-anders.roxell@linaro.org> References: <20210115130906.1084281-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 5b058973d3205578aa6c9a71392e072a11ca44ef upstream. When building mips tinyconfig with clang the following warning show up: arch/mips/lib/uncached.c:45:6: warning: variable 'sp' is uninitialized when used here [-Wuninitialized] if (sp >= (long)CKSEG0 && sp < (long)CKSEG2) ^~ arch/mips/lib/uncached.c:40:18: note: initialize the variable 'sp' to silence this warning register long sp __asm__("$sp"); ^ = 0 1 warning generated. Rework to make an explicit inline move, instead of the non-standard use of specifying registers for local variables. This is what's written from the gcc-10 manual [1] about specifying registers for local variables: "6.47.5.2 Specifying Registers for Local Variables ................................................. [...] "The only supported use for this feature is to specify registers for input and output operands when calling Extended 'asm' (*note Extended Asm::). [...]". Cc: # v5.4+ [1] https://docs.w3cub.com/gcc~10/local-register-variables Signed-off-by: Anders Roxell Reported-by: Nathan Chancellor Reported-by: Naresh Kamboju Reviewed-by: Nick Desaulniers Signed-off-by: Thomas Bogendoerfer --- arch/mips/lib/uncached.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c index 09d5deea747f..f80a67c092b6 100644 --- a/arch/mips/lib/uncached.c +++ b/arch/mips/lib/uncached.c @@ -37,10 +37,12 @@ */ unsigned long run_uncached(void *func) { - register long sp __asm__("$sp"); register long ret __asm__("$2"); long lfunc = (long)func, ufunc; long usp; + long sp; + + __asm__("move %0, $sp" : "=r" (sp)); if (sp >= (long)CKSEG0 && sp < (long)CKSEG2) usp = CKSEG1ADDR(sp); -- 2.29.2