Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3039265imu; Mon, 19 Nov 2018 09:42:52 -0800 (PST) X-Google-Smtp-Source: AJdET5cz5tuTsFay7eOQcsc4Nk1CyOb6vkwH1w0/fxIeJkrgRQHfFDcPxUyJrKEEX1rp9+ElW3w5 X-Received: by 2002:a62:7e13:: with SMTP id z19mr12863673pfc.94.1542649372507; Mon, 19 Nov 2018 09:42:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542649372; cv=none; d=google.com; s=arc-20160816; b=VJE6u6dxZT0qZd9Xsoph9HlL5jYGrwXRyFGcXbcNeyIXLLC6p6GazKMebesYq5uWbI LZezJ7T0eb/riDSDyZh9ONs5y0ua+v7VEpJF40i25wWCyj5IBp4cPvL6t3AM6YlaeBTk Wi7pieoqlnbJEF7OU9vO164dfQFAgrXOLaq9raJiMfqQHOWTTmn7EDXLLETZC1dAgmHg q0NIZNlPg9FIYdi619+/mBzAL0udsdj351qbY0aRdWPEdUlJprp3zTciG2vTmgV85G0t 3e7DNgNKibSr1IfLMUNI9C3/O2wT919j39yHRUCVWRplmbUEq28OrrwTdeLbI2WKyI6d 4cew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :dkim-signature; bh=2e9GmcmvDnjGTuB1UfTZyLTxmQvy2ZTf8CtPcYRwmyw=; b=xgZ9qkIOexj4oy4BXVtcXHp1gJgSJ2oLawBYflJsWS8nSfYNyldAHiuCzOWQwVeKtr addLhmSBA63AwhqcL0zhOPBa7P4+JfYKtOxkYxgkeGvAOY7Ndlta9wzpEguyC9UjQnw1 EQiWDNi3A7wB+Tdfjqzsb9J3d/a1f/splBVYbxYFqo87jBXgF2kuAZTMn9U847M1tgWo qqyrVyY/o1xuI4J42IAMXlaXXc+qEyy9m92AedNjAcMJLVGZwW6U4SN+LP85yVDEO2RX qPv4KA88I01NLAdXYw+oUM/zjStoB19fFM+2DwCsGLxbCeLYbYn9YlcznQMzdzQm4r0X XqOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cinyNuMb; 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 l8si39054235pgr.345.2018.11.19.09.42.37; Mon, 19 Nov 2018 09:42:52 -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=fail header.i=@gmail.com header.s=20161025 header.b=cinyNuMb; 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 S2390032AbeKTEEy (ORCPT + 99 others); Mon, 19 Nov 2018 23:04:54 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:40138 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389229AbeKTEEx (ORCPT ); Mon, 19 Nov 2018 23:04:53 -0500 Received: by mail-ot1-f67.google.com with SMTP id s5so28400760oth.7; Mon, 19 Nov 2018 09:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=2e9GmcmvDnjGTuB1UfTZyLTxmQvy2ZTf8CtPcYRwmyw=; b=cinyNuMbhZwoBooqNjdQCQXEyqUn9PWdVEcJO3QAaD38dMD0JTKECO/+eFs4SAdVNf hXAcrsAW2bGSbWcyZdoywh14I9OTpmZvD6egdT8DYDroeUARVTKh6CXn7EgRmx0NmAXI kfv6f9s5ciRZ61RCfpSvGDh/YWelagNgn4UeQy1k07rYARL6SUwdW8p2U3LjAkyUH2/k u48EKEgAKPDoIoQrQpUqr11qhBgH7aaR5uGtSFsvEQ5WyMmcCaGf+zo9JfSFTUMFoInW VZ+ywBVW2jVtnd7tZ6fYZbwexYA65KmDruJCImACX7AbUmHhugS7MSk/bIOn9GqNRQ3m EyfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=2e9GmcmvDnjGTuB1UfTZyLTxmQvy2ZTf8CtPcYRwmyw=; b=AhsKGJoSQKu7rtGsYb6IRI3p0jqmivMegCFv+zOVfmCqE8i6z8fgAfU2E+7XKF8K/C DOLXlXX99eU7rAXIsVyyzNDNDpknCuBnDAZ2Y0SIWIPotmx6WxwZ6Pbv/MzKW3Mg4W2g mWbthsblFRwXWxD+Cw89Of6CDol1kpk3wujm2hzEW0s/glihtJJ23VBLHsPHED7PN0u0 s7ypwRbHeZz2W3k4Nsik8hq959H6CY11hlutJckjRRD95mzL2Zj3i26sz2KcschkyuxB /Sd5t89OV2Ma8p9ufgYySl3DKHc2GD1eBmfjmjLfMaR/nGE8ZiJrBaLXhnIUZpxAl1re tyHA== X-Gm-Message-State: AGRZ1gLK69+Mr8bHE1u5PKsmAvSz2I7yIVvFKC+dKJuUsmkv2vLGwWfN 3c1T6W6xDMuoDUqjqwGDuqTWHlfT X-Received: by 2002:a9d:2cbc:: with SMTP id p57mr12985701otb.1.1542649225187; Mon, 19 Nov 2018 09:40:25 -0800 (PST) Received: from [192.168.1.104] (cpe-24-31-245-230.kc.res.rr.com. [24.31.245.230]) by smtp.gmail.com with ESMTPSA id w186-v6sm13869955oig.52.2018.11.19.09.40.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 09:40:21 -0800 (PST) Subject: Re: [PATCH v3 3/3] b43: Use cordic algorithm from kernel library To: Priit Laes Cc: Kees Cook , Jia-Ju Bai , Kalle Valo , "Gustavo A. R. Silva" , Colin Ian King , Arend van Spriel , Varsha Rao , linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, linux-kernel@vger.kernel.org References: <20181118082327.ttrz2nl5owi2hoqv@plaes.org> <20181119112755.qtthenx54v3tnok3@plaes.org> From: Larry Finger Message-ID: Date: Mon, 19 Nov 2018 11:40:22 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181119112755.qtthenx54v3tnok3@plaes.org> Content-Type: multipart/mixed; boundary="------------FD22EC480DE4FF646E0A5039" Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------FD22EC480DE4FF646E0A5039 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 11/19/18 5:27 AM, Priit Laes wrote: > On Sun, Nov 18, 2018 at 01:35:57PM -0600, Larry Finger wrote: >> On 11/18/18 2:23 AM, Priit Laes wrote: >>> On Sat, Nov 17, 2018 at 09:31:35PM -0600, Larry Finger wrote: >>>> On 11/14/18 12:27 PM, Priit Laes wrote: >>>>> Kernel library has a common cordic algorithm which is identical >>>>> to internally implementatd one, so use it and drop the duplicate >>>>> implementation. >>>>> >> >> My test setup has a hardware failure, thus I cannot test your patch, but I >> now believe it to be correct. Thus your first and third patches may be >> annotated with >> ACKed-by: Larry Finger >> >> One thing that should be done is to fix the error in the b43 code for stable >> as it was introduced in 2.6.34. I propose adding the attached patched to >> your series placed between your current 2nd and 3rd patches so that the old >> kernels get fixed. Of course, your 3rd patch will need to be revised. If all >> 4 of the patches get submitted together there will be no problems with the >> timing. My change will exist for seconds in the mainline kernel, but it will >> get propagated back through stable. > > Thanks! > >> From b42ae73ef7505de93e4c66fb9f66930e3f3d969a Mon Sep 17 00:00:00 2001 >> From: Larry Finger >> Date: Sun, 18 Nov 2018 13:15:07 -0600 >> Subject: [PATCH] b43: Fix error in cordic routine >> MIME-Version: 1.0 >> Content-Type: text/plain; charset=UTF-8 >> Content-Transfer-Encoding: 8bit >> To: kvalo@codeaurora.org >> Cc: linux-wireless@vger.kernel.org >> >> The cordic routine for calculating sines and cosines that was added in >> commit 986504540306 ("b43: make cordic common (LP-PHY and N-PHY need it)") >> contains an error whereby a quantity declared u32 can in fact go negative. > > It seems to be different commit though: > commit 6f98e62a9 ("b43: update cordic code to match current specs") Thanks for catching that mistake. I must have gotten one line off in my copy and paste. The respun version of my patch is attached. I have now been able to test b43 on an LP-PHY device. I do not see any major changes, but there has to be some effect. Larry Larry --------------FD22EC480DE4FF646E0A5039 Content-Type: text/x-patch; name="0001-b43-Fix-error-in-cordic-routine.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-b43-Fix-error-in-cordic-routine.patch" From b42ae73ef7505de93e4c66fb9f66930e3f3d969a Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sun, 18 Nov 2018 13:15:07 -0600 Subject: [PATCH] b43: Fix error in cordic routine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org The cordic routine for calculating sines and cosines that was added in commit 6f98e62a9f1b ("b43: update cordic code to match current specs") contains an error whereby a quantity declared u32 can in fact go negative. This problem was detected by Priit Laes who is switching b43 to use the routine in the library functions of the kernel. Fixes: 6f98e62a9f1b ("b43: update cordic code to match current specs") Reported-by: Priit Laes Cc: Rafał Miłecki Cc: Stable # 2.6.34 Signed-off-by: Larry Finger --- drivers/net/wireless/broadcom/b43/phy_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/b43/phy_common.c b/drivers/net/wireless/broadcom/b43/phy_common.c index 85f2ca989565..ef3ffa5ad466 100644 --- a/drivers/net/wireless/broadcom/b43/phy_common.c +++ b/drivers/net/wireless/broadcom/b43/phy_common.c @@ -616,7 +616,7 @@ struct b43_c32 b43_cordic(int theta) u8 i; s32 tmp; s8 signx = 1; - u32 angle = 0; + s32 angle = 0; struct b43_c32 ret = { .i = 39797, .q = 0, }; while (theta > (180 << 16)) -- 2.16.4 --------------FD22EC480DE4FF646E0A5039--