From patchwork Thu Dec 19 18:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182153 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp850514iln; Thu, 19 Dec 2019 10:36:07 -0800 (PST) X-Google-Smtp-Source: APXvYqza7Ree6XnT5vqL/ICXEJuW15lSUGkHIuZf2JsnKlCm0rgaifxRvJYkXg7kWmDGkxVSDO1t X-Received: by 2002:a05:6830:3016:: with SMTP id a22mr3610152otn.177.1576780566994; Thu, 19 Dec 2019 10:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780566; cv=none; d=google.com; s=arc-20160816; b=arLUutAozpkRz+zS53z00PE/nalHZbuJuBl2r5Wst8ONFLBQebD+gL4RntVLTHNSS0 WRuu+nyLqLW/Atd9KwwI9CrxBjp/cy5XPANlODrLCcNm5sBPb5G8iikWT/InZLezhaA9 jC3KMyuGy1/DuEbymt9dDs+VLBcaRi4BoeGMUUmD6VsrOjKbiMwyQWzN4bjPb2t0t9rt 4v453fxTSjlqFBuaqHVFDvFRzM3TKC8spjc2J+j5QwT7WPDeRW/Mmmc7ax+8CWFCGAov nwNlcnwKBepgClkuazhUOIAL4C8aO0Ak1eWjD7WyNXdwEM0ePUC4pIXbpwlPHHyLMtIP ZAHg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o7qcsdTm5r5QYwOm0T7LfrDrjEDgR32ah8ikCmWoGsk=; b=OXqcBmB2qtZI22JgzWRyc6JVVxmECKBfNZy1XebcPep7OLEOMTelScsv2xwDOIUA1Y wYRtQFY28DVqaPUghHODhLAKISLbKMiC01WMQFCnUxrtSsCimKbO1nxUbj8CH1AoSiMe bfzJSqCRc91fYQSy8AX2zmryamA2uH8i3lr2KFq+uy7KU4L5Upmdcwbvv+HiZUiMbVs5 514+gxjJZBG6nE7VJwGYmM2V9cZHvG4WRzDq0YBVKRiEa/I2s7AF0MIK1/OsyQqfixMG BeSVD321uRVyiwGe6CwtQr/0X1+6KUa6MfAgrQ2xSBz4bLILNxmFHgmwDA6ge9TzjYSl XWBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RJGyTSc+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 45si739769oty.188.2019.12.19.10.36.06; Thu, 19 Dec 2019 10:36:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RJGyTSc+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbfLSSgF (ORCPT + 27 others); Thu, 19 Dec 2019 13:36:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:52830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727411AbfLSSgC (ORCPT ); Thu, 19 Dec 2019 13:36:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 584202467B; Thu, 19 Dec 2019 18:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780561; bh=k2Tugx47zeg+LMX++8o2J3UvSOhXZuufBvGIQnE3IIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJGyTSc+xIfqnbapY2y8sxnOHEteXropBRt91jV4dPwCWFHkrVyFwYCBQhfFN8GlC ulQP6E4PbwZwZ1GBexsmOAipegWaDsy+IZra/qW5lP9bqIkK14gUt99wfAHk+S2kOd UaQ6ZVvB/JB5kdjLs03WEaz2C1LamnZad08NYdas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cheng-Yi Chiang , Mark Brown , Douglas Anderson , Sasha Levin Subject: [PATCH 4.4 024/162] regulator: Fix return value of _set_load() stub Date: Thu, 19 Dec 2019 19:32:12 +0100 Message-Id: <20191219183208.988306001@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown [ Upstream commit f1abf67217de91f5cd3c757ae857632ca565099a ] The stub implementation of _set_load() returns a mode value which is within the bounds of valid return codes for success (the documentation just says that failures are negative error codes) but not sensible or what the actual implementation does. Fix it to just return 0. Reported-by: Cheng-Yi Chiang Signed-off-by: Mark Brown Reviewed-by: Douglas Anderson Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- include/linux/regulator/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 9e0e76992be08..bf62713af290e 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -485,7 +485,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator) static inline int regulator_set_load(struct regulator *regulator, int load_uA) { - return REGULATOR_MODE_NORMAL; + return 0; } static inline int regulator_allow_bypass(struct regulator *regulator, From patchwork Thu Dec 19 18:32:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182154 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp851038iln; Thu, 19 Dec 2019 10:36:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyEh2rrZ9Z7YXcdDjgMp+4moMpH2+BUJxX/kC3AZclwgxVQIwFjitNS2SqCM/UxkEUFnZej X-Received: by 2002:a9d:3a65:: with SMTP id j92mr9874649otc.37.1576780595753; Thu, 19 Dec 2019 10:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780595; cv=none; d=google.com; s=arc-20160816; b=oRwufYlyy0EyQ1kyReE4DPUJvoRz5WtAgl+FLpkfmZAvhr0L0qnIbu7Lp1mR76HVGp v9XRV641/Gn989IxJoLopejicDdtSCosI/x5ATgFgOzh8isCD+WJq3U7I1JlDiZ5by3U tHzq4ZG5SO2r70EOur6Sgg81VoWlrRDmmuHd9oRB8l74dDx9/8m7VGegRoCeWr+CrX10 60Vfor6MmZns3Y76P9UjpoWtkJSBnbcBHY8tFZSvrebWJtg9FgAlkQWbwqtTYKS3/vNe 1HuSYA58JJ2LE1yYMwdXXQ5fLSsXYu+95xjSjXi1V41OL7Fj9+7FDqMJYOrXGKmk5B7g 6eeQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nq9AriTJbqymOFz8l+g17ADsgyCAh4sUFUn4oezzIYU=; b=f+/l1GV8k7WkQoDo8bFkLlOX2MaDgixO2k0btixrUbETFOGKNKoG/Dj/XNGuKqUPwn RUsGQFes5E0y1gISDy4sE/tc91BpCYyAKRNNrNiJ//J49VVP6BlZl4/3+GSrxnkfYETT 5iSIPlkKiVjbB72y2I744yl2wcw2FBdd++ZfyF980Hb+/OtyeK6TTqqx/zkEUzCa1Ie4 71vSifgQ9f5lSyk+Vv/MLf9aPvcY93OA2XMRltQhZKkACJynxaB9QH31+mVpIXlhvLwu PAmYdKiso+xkszsO3aeGg3b0yPYZ7VTpK6bDLJQlAerhsN7nh27nO3pUp87RAfEw1N1s +oow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rsdnvBju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si1557026otr.233.2019.12.19.10.36.35; Thu, 19 Dec 2019 10:36:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rsdnvBju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbfLSSge (ORCPT + 27 others); Thu, 19 Dec 2019 13:36:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:53548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbfLSSgb (ORCPT ); Thu, 19 Dec 2019 13:36:31 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA5F024672; Thu, 19 Dec 2019 18:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780591; bh=Isu3PsevsWCapFsKhQtOcN0Gn243im6GOktkJsovBIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsdnvBjusCu+2bVCr5DAZhpuNX4keSRLeStVuKt90kgWKJdIcArWVqA08ISUWDQKr 5+vPQrVwTDHAoWhYIZVVMAByJi2SwnTH5vaYoW6LQUMpa3Rs3vfOoc3Yt69FBJJiQg 2kZpyZeUfYd1lDZZ6B+eRNqz6tcdpn8ZCKs+xTYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.4 029/162] ARM: dts: exynos: Use Samsung SoC specific compatible for DWC2 module Date: Thu, 19 Dec 2019 19:32:17 +0100 Message-Id: <20191219183209.421641412@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski [ Upstream commit 6035cbcceb069f87296b3cd0bc4736ad5618bf47 ] DWC2 hardware module integrated in Samsung SoCs requires some quirks to operate properly, so use Samsung SoC specific compatible to notify driver to apply respective fixes. Signed-off-by: Marek Szyprowski Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin --- arch/arm/boot/dts/exynos3250.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi index e81a27214188c..cbe3507e6e249 100644 --- a/arch/arm/boot/dts/exynos3250.dtsi +++ b/arch/arm/boot/dts/exynos3250.dtsi @@ -325,7 +325,7 @@ }; hsotg: hsotg@12480000 { - compatible = "snps,dwc2"; + compatible = "samsung,s3c6400-hsotg", "snps,dwc2"; reg = <0x12480000 0x20000>; interrupts = <0 141 0>; clocks = <&cmu CLK_USBOTG>; From patchwork Thu Dec 19 18:32:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182156 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp851565iln; Thu, 19 Dec 2019 10:37:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzO2VyEv+xreGVWC+zKfjatuiA3FhoR3FFUbwSfYz7zP3KG2tT1A/+4S18xBc/D3+V1WdUY X-Received: by 2002:a05:6830:22e6:: with SMTP id t6mr10745919otc.244.1576780624633; Thu, 19 Dec 2019 10:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780624; cv=none; d=google.com; s=arc-20160816; b=GJUUDX+ho1+sPCJ205B5zl5x9QbqFq1b0iOrJukgG1WiSbYN7ybNSV6Y2jm9IUlGG+ cutIlggfvCE5rAbr4fV+ImxVD+6MWQ+78hbFwIMxie8CX/7xwmfaqNrq6o49y0Yie1vO xTukGFzDcPWA52XQs80gdEJG0+mmFFHQOWd1d3jd5BbTtuxzVrUdUTs8IKN5ZaNdgdta m5gBlfn9RQ8LRPyxzvY9m5x8PNd0YmW5swDBDL/QHzKrxqUWCXvoez/Tay/R1JjZMZTR ShGiV+9Rhe8JNEe8mlDwONngpfw9bqJ3VCU2/7M+zFK7TkPUplOKs/TMHid4CaleJboK 152Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dDq+WKl9XFwhH5McBizAftmJWiZ1h3imxqy/7AlKzWg=; b=FZXz5QBKlkrO+xwPo710bjEpJCqCGZRYo1ARP6YoVKGUe07SF3Hufpr1bq2gyvNZ46 4yF7vN3mIpxUxS5ZmpYe2k2mzr57GSpJqBXWj7H7ur5I0IvWo9Y05fbPk2Pl9F10CNTZ V1ngubj3uQJkn2PJBWpFKBdaEwtxVymW18m/SbrF2KY6nNFzd8jLSscMmxnx8M6fEqyJ vHBE2zZDVGwgOyiSRiVwT38yJpn6p7tfW+O8EJbJsiOxne3I1v7zbDojWyijpnaE8ZBn fxyNfwhTLegkaTRczJT50fvDB3s3I1o4EbrLdp251Es+UXFB3j9X14FD+eqU940aVESB L0DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ns43stbN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si3654414otr.197.2019.12.19.10.37.04; Thu, 19 Dec 2019 10:37:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ns43stbN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727747AbfLSShD (ORCPT + 27 others); Thu, 19 Dec 2019 13:37:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:54298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727229AbfLSShB (ORCPT ); Thu, 19 Dec 2019 13:37:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06A4324672; Thu, 19 Dec 2019 18:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780620; bh=m0Xi4nTk+oGEpyZ0wdmXOfeFk6InEJHjaHdGJ/1h9rE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ns43stbNQJi85jv9JsG1XUYlcfLToWqip/gN9INC0Dy5PCWlnROxQXGNbQbhpLQmH lr32jw9Yb1Bc70hTqReHSpVCo8U9opth6zv0juKBQfZvNe6ZxigJA5CcA7HLWZtP2j c07WMQD5L2FqVzlJoOGFjg9HIZzqDwuQXn8Ox4V8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Nick Desaulniers , Segher Boessenkool , Michael Ellerman , Sasha Levin Subject: [PATCH 4.4 048/162] powerpc/math-emu: Update macros from GCC Date: Thu, 19 Dec 2019 19:32:36 +0100 Message-Id: <20191219183210.816865498@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joel Stanley [ Upstream commit b682c8692442711684befe413cf93cf01c5324ea ] The add_ssaaaa, sub_ddmmss, umul_ppmm and udiv_qrnnd macros originate from GCC's longlong.h which in turn was copied from GMP's longlong.h a few decades ago. This was found when compiling with clang: arch/powerpc/math-emu/fnmsub.c:46:2: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions FP_ADD_D(R, T, B); ^~~~~~~~~~~~~~~~~ ... ./arch/powerpc/include/asm/sfp-machine.h:283:27: note: expanded from macro 'sub_ddmmss' : "=r" ((USItype)(sh)), \ ~~~~~~~~~~^~~ Segher points out: this was fixed in GCC over 16 years ago ( https://gcc.gnu.org/r56600 ), and in GMP (where it comes from) presumably before that. Update the add_ssaaaa, sub_ddmmss, umul_ppmm and udiv_qrnnd macros to the latest GCC version in order to git rid of the invalid casts. These were taken as-is from GCC's longlong in order to make future syncs obvious. Other parts of sfp-machine.h were left as-is as the file contains more features than present in longlong.h. Link: https://github.com/ClangBuiltLinux/linux/issues/260 Signed-off-by: Joel Stanley Reviewed-by: Nick Desaulniers Reviewed-by: Segher Boessenkool Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/sfp-machine.h | 92 ++++++++------------------ 1 file changed, 29 insertions(+), 63 deletions(-) -- 2.20.1 diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h index d89beaba26ff9..8b957aabb826d 100644 --- a/arch/powerpc/include/asm/sfp-machine.h +++ b/arch/powerpc/include/asm/sfp-machine.h @@ -213,30 +213,18 @@ * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow * (i.e. carry out) is not stored anywhere, and is lost. */ -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ else \ - __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "%r" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "%r" ((USItype)(al)), \ - "rI" ((USItype)(bl))); \ + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ + : "=r" (sh), "=&r" (sl) \ + : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ } while (0) /* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to @@ -248,44 +236,24 @@ * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, * and is lost. */ -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else \ - __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ - : "=r" ((USItype)(sh)), \ - "=&r" ((USItype)(sl)) \ - : "r" ((USItype)(ah)), \ - "r" ((USItype)(bh)), \ - "rI" ((USItype)(al)), \ - "r" ((USItype)(bl))); \ + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ } while (0) /* asm fragments for mul and div */ @@ -294,13 +262,10 @@ * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype * word product in HIGH_PROD and LOW_PROD. */ -#define umul_ppmm(ph, pl, m0, m1) \ +#define umul_ppmm(ph, pl, m0, m1) \ do { \ USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhwu %0,%1,%2" \ - : "=r" ((USItype)(ph)) \ - : "%r" (__m0), \ - "r" (__m1)); \ + __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ (pl) = __m0 * __m1; \ } while (0) @@ -312,9 +277,10 @@ * significant bit of DENOMINATOR must be 1, then the pre-processor symbol * UDIV_NEEDS_NORMALIZATION is defined to 1. */ -#define udiv_qrnnd(q, r, n1, n0, d) \ +#define udiv_qrnnd(q, r, n1, n0, d) \ do { \ - UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ + UWtype __d1, __d0, __q1, __q0; \ + UWtype __r1, __r0, __m; \ __d1 = __ll_highpart (d); \ __d0 = __ll_lowpart (d); \ \ @@ -325,7 +291,7 @@ if (__r1 < __m) \ { \ __q1--, __r1 += (d); \ - if (__r1 >= (d)) /* we didn't get carry when adding to __r1 */ \ + if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ if (__r1 < __m) \ __q1--, __r1 += (d); \ } \ From patchwork Thu Dec 19 18:32:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182159 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp854555iln; Thu, 19 Dec 2019 10:39:51 -0800 (PST) X-Google-Smtp-Source: APXvYqywFCD5N0ba6Z8zDTvEEkOP3vXmhuIVLiAKcxbFMtyXnYoIInPf17jpZwBJgWs6syXHkwtW X-Received: by 2002:a05:6830:1407:: with SMTP id v7mr10527059otp.58.1576780791837; Thu, 19 Dec 2019 10:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780791; cv=none; d=google.com; s=arc-20160816; b=na0hE0S8cOVzFwsuk9TtphLgW6tb2+rVE1jMtwkFZQywiaAdmowDbv0NpjBr6vU8jS +/GSmitN8uLw2Ez2LA2cQoVqlO54c5LGXaCzTriRnpm0QoLPD7IKyF1GEKd3VU8nmVve bYQmu2o1HZMeAj/3/luawnrYReKtIHuBoQjjoEOVmtWIg1+ipPoiXU3N5/QCuC2TUJyY 1xHmc2WUPjmrs5/SRsIjfbiDkb3KUgfGSwmJN9sotCDm/kAPUp5me0I0imsG6QCQ48Ps z+MdD4Sf4y+h1Kc5G4V5I05/lhXS2/LgzO4Fdn2UOuWTW+VsrBzxR6YgDB/m1D8w0ljf vvxA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UhOp/l3ujFqz6RAm/8VTdFIsvCu9tVGgETC5hzpHcUo=; b=uoI4mqxO34JfjyRcGxhFETEW1g5pwlPHhXJ1MLDALforVNXx0ghOJT1DYoQkQRuk0X vIZ8IfYlPTQA1u0a3uiweDrOCE8S18J46+t+XhECKigLHJ/2VPso1ZxQX9DhztQVNmL6 U0Q4KvMPzEMgxoUwQKX/mwdZlqOvdb48xTUvTy7vt966cArwik4VvFJB2qNeF5/hvPi3 qHNm39aSVTDbBTwV2jfMM2r8WJAL8m+fLXwwHEj3HGmMyACXGyG0AYvXSU0j8YBDiMr0 LhSlUDzeqWfSU3TWnMDaYzyChZ/na8IM5AG787eGMmqXhhzVg8hYCFJN5s6Ahc6Gv8vg TFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SsJkkgju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si3603869otr.69.2019.12.19.10.39.51; Thu, 19 Dec 2019 10:39:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SsJkkgju; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728288AbfLSSju (ORCPT + 27 others); Thu, 19 Dec 2019 13:39:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:58272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727980AbfLSSjs (ORCPT ); Thu, 19 Dec 2019 13:39:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D51BA206D7; Thu, 19 Dec 2019 18:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780787; bh=bMEM8CgX/6uIErmN9B5ttGlNi4wBwVVcAmuXfFf4Z8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SsJkkgjuVbytuqrCY0aDQ3JHaMQ50TPjldHBU3AyLaJpAOJuoi5P0Nkp62OBVtCvI BVmai9aiV+S/NeNCYs/Y+wKOvZY+OXH2rejdMQDBOVvpbk4qJJ9SQbHVAey9F41uRh dpaER00qXLA/mlvRGyjL2WUTnUa2jyGUWDUt4MJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viresh Kumar , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.4 069/162] RDMA/qib: Validate ->show()/store() callbacks before calling them Date: Thu, 19 Dec 2019 19:32:57 +0100 Message-Id: <20191219183212.021314208@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Viresh Kumar commit 7ee23491b39259ae83899dd93b2a29ef0f22f0a7 upstream. The permissions of the read-only or write-only sysfs files can be changed (as root) and the user can then try to read a write-only file or write to a read-only file which will lead to kernel crash here. Protect against that by always validating the show/store callbacks. Link: https://lore.kernel.org/r/d45cc26361a174ae12dbb86c994ef334d257924b.1573096807.git.viresh.kumar@linaro.org Signed-off-by: Viresh Kumar Reviewed-by: Greg Kroah-Hartman Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/qib/qib_sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c @@ -301,6 +301,9 @@ static ssize_t qib_portattr_show(struct struct qib_pportdata *ppd = container_of(kobj, struct qib_pportdata, pport_kobj); + if (!pattr->show) + return -EIO; + return pattr->show(ppd, buf); } @@ -312,6 +315,9 @@ static ssize_t qib_portattr_store(struct struct qib_pportdata *ppd = container_of(kobj, struct qib_pportdata, pport_kobj); + if (!pattr->store) + return -EIO; + return pattr->store(ppd, buf, len); }